Bible Notes Online - Genesis 40 - ESV
Commentary

v1-3: Joseph is imprisoned with two men; one died and one lived (Luke 23.32,39,43).

v4: Joseph attended, or served, them. He cared for his fellow prisoners. This is further indication of his faithfulness.

v8: Joseph had confidence in God's ability to reveal the meaning of dreams; God is the revealer of secrets (Dan 2.28). Like Daniel, he does not claim any special power himself. Again, God's blessing upon Joseph overflows to others.

v14-15: After explaining the butler's dream, Joseph asks him to mention his case to Pharaoh.

v20-22:   There is a striking picture here, of the resurrection; the cupbearer was raised to honour, the baker to dishonour. They were both released from prison, referring to the domain of the dead, where all who died before Christ went.

v23: Although Joseph had been faithful, and his interpretation had proved accurate, the butler forgot him. Men do disappoint us, but God remains faithful. The butler forgot the request "remember me"; but Christ honoured the same request; see Luke 23.42.