mbtamuli's scratchpad To infinity and beyond

Postfix in a container

Postfix is a service which forks itself and runs in the background. Postfix version 3.3.0 added container support. There was an issue where Postfix could not run as PID=1, and it was swiftly fixed in version 3.3.1

As I could not find any official Docker image for the latest versin of Postfix, I decided to build one myself. At the time I built the image, there was no Debian package available so I had to compile the package from source.

Here is the link to the Dockerfile.

You can build the docker image yourselves and use it too. Just run

git clone https://github.com/EasyEngine/dockerfiles.git
cd postfix
docker build -t postfix .

# Now run the docker image using
docker run \
-h example.com \
-p 1025:25 \
-v "/dev/log:/dev/log"

Now you can point in the smtp settings to use localhost:1025. The logs will be available at /var/log/mail.log on your host.