Simple Docker Postfix container 2016-04-13


E-mail forwarding w/Virtual hosts support in a compact Docker container

We've put together a simple container primarily for use to forward e-mail from secondary domains we manage to our main domain.

Here you'll find the Github repository.

To make use of it, you might e.g use a Systemd service file somewhat like this:

[Unit]
Description=Postfix mail delivery
Requires=docker.service
After=docker.service

[Service]
Restart=always
RestartSec=5
StartLimitInterval=0
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker pull vidarh/postfix
ExecStartPre=-/usr/bin/docker kill %p
ExecStartPre=-/usr/bin/docker rm %p
ExecStartPre=-/usr/bin/docker run -d --name %p -v /dev/log:/dev/log -v /home/core/etc/postfix/valias:/etc/postfix/valias:ro -v /home/core/etc/postfix/vmailbox:/etc/postfix/vmailbox:ro -p 25:25 vidarh/postfix
ExecStartPre=-/usr/bin/docker run -d --name %p -v /dev/log:/dev/log -v /home/core/etc/postfix/valias:/etc/postfix/valias:ro  -p 25:25 vidarh/postfix
ExecStart=/usr/bin/docker start -a %p
ExecStop=/usr/bin/docker stop %p
ExecStopPost=-/usr/bin/docker rm -f %p

[Install]
WantedBy=multi-user.target

And then put a "valias" file:

@example.com address.to.foward.to@myother.example.com

(you can specify individual users etc. too - anything Postfix can handle).

And provide a "vmailbox" file with dummy entries for the domains:

example.com domain

( If you are looking for someone to set up and manage a Postfix - or other - setup for you, contact us )


blog comments powered by Disqus