0

I started mailhog in container: docker run --rm -ti -p 8025:8025 -p 1025:1025 mailhog/mailhog. Web UI works, but connection fails:

curl smtp://172.17.0.2:1025 --mail-from a@b.com --mail-rcpt c@d.com

curl: (28) Failed to connect to 172.17.0.2 port 1025 after 31641 ms: Operation timed out

172.17.0.2 is container IP address, i'm using Docker Desktop for Mac. Why connection is not established?

  • Where do you run `curl`? On your host (Mac)? Have you tried `localhost instead of the IP (i.e. `curl smtp://localhost:1025 --mail-from a@b.com --mail-rcpt c@d.com`)? How did you find out the given IP? – maiermic Dec 14 '21 at 16:54

1 Answers1

0

I solved this problem by connecting mailhog container to a network defined in docker-compose.yml.