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?
I solved this problem by connecting mailhog container to a network defined in docker-compose.yml.