You might be getting blocked by AWS security groups. Try creating a security group allowing outbound to that address and port. Don't forget to assign it to the instance where it is running. Once that is in place, try making an outbound connection from the instance running docker (but not inside docker itself). openssl s_client -connect smtp.gmail.com:587 If successful, you will see a connection and a certificate sent back. Then, at least, you'll know you can connect from the instance itself.
... View more