I have an app which sends email and requires smtp running on port 25. For which I created another container and mapped port 25 from host to container.
That didnt quite work well, as it kept throwing the following error
ERROR: for smtp Cannot start service smtp: driver failed programming external connectivity on endpoint push_smtp_1 (25f260f6185dd34cfdb8fb9956c28187028aaca4d850d7a73acc4c2180c55696): Error starting userland proxy: Bind for 0.0.0.0:25: unexpected error (Failure EADDRINUSE)
Not sure what could be wrong here, following the other posts I tried restarting the docker client, as well as verified that there is nothing else running on port 25 lsof -i:25 Let me know if I am missing something here.
The 2nd part to this question is, what is the Ideal way to deal with smtp server.
Should the smtp server be created within the app container. Came across this blog http://www.tothenew.com/blog/setting-up-sendmail-inside-your-docker-container/
If not (1), then is it better to create a smtp container and map ports.Is so, whats the reason for getting the above error.
Below is how my docker-compose:
version: '3'
services:
push:
image: emailService
ports:
- "9602:9602/tcp"
networks:
- default
build:
context: ./
dockerfile: Dockerfile
args:
- "TARGET=build"
depends_on:
- gearmand
- smtp
smtp:
image: catatnight/postfix:latest
ports:
- "25:25"
networks:
- default
gearmand:
image: <path>/<to>/gearmand:latest
ports:
- "4730:4730/tcp"
networks:
- default
Thanks!