Docker Community Forums

Share and learn in the Docker community.

Getting "No route to host" in a container when attempting to SMTP to the internet

docker
#1

I create a container and try to connect to an smtp server on the internet on port 25 and I get no route to host

I can however connect to the internet, the apt calls work fine fetching the packages for telnet, and I can telnet to google on port 80, however, gmail mx host on 25 doesnt work.

docker run -ti ubuntu /bin/bash
root@083a95f2d9d3:/# apt update && apt install telnet -y
...snip...

root@083a95f2d9d3:/# telnet alt2.aspmx.l.google.com 25
Trying 108.177.104.27...
Trying 2607:f8b0:4003:c04::1b...
telnet: Unable to connect to remote host: Cannot assign requested address
root@083a95f2d9d3:/# telnet 64.233.179.26 25
Trying 64.233.179.26...
telnet: Unable to connect to remote host: No route to host
root@083a95f2d9d3:/# telnet www.google.com 80
Trying 172.217.167.68...
Connected to www.google.com.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
root@083a95f2d9d3:/#

The host has iptables installed and docker is updating it, however I don’t really know enough about it to know if it’s iptables blocking a specific port?

Can anyone help point me in the right direction?