a simple "SMTP Only" postfix image.
Emails can be send from any private network address:
Start the image and include your (docker) hosts DNS entry. e.g.
docker run -d --name postfix -p 25:25 --restart always yorkshirekev/postfix mail.example.com
Source-code for this image is on GitHub: https://github.com/YorkshireKev/docker-postfix
In your Docker image (and others) postfix status and stop is not working. I had same issues and I'm happy to share the solution:
Consider adding the following lines to your docker init-file to get postfix service status and stop working.
'# adjust postfix status in init-file for docker as even root does not have acl to read from /proc/$PPID/exe
if [ ! -e /etc/init.done ] ; then
sed -i -e 's~dir=$(ls -l /proc/$pid/exe~pgrep -f /usr/lib/postfix -s "$pid" \&\& echo y || true \n\t#dir=$(ls -l /proc/$pid/exe~' /etc/init.d/postfix
Now you can also replace in init-file the tail -f by a verification loop that postfix is running or else terminate the docker container:
while service postfix status | grep -q "postfix is running" ; do sleep 10 ; done
echo "exiting as postfix service failed to run"
Updated image - To allow mail to also be sent to addresses at the same domain as postfix is running; e.g. email@example.com if the postfix server was running at mail.example.com