tozd/postfix
https://gitlab.com/tozd/docker/postfix
Available as:
tozd/base
← tozd/dinit
← tozd/postfix
ubuntu-trusty
: Postfix 2.11.0ubuntu-xenial
: Postfix 3.1.0ubuntu-bionic
: Postfix 3.3.0ubuntu-focal
: Postfix 3.4.13ubuntu-jammy
: Postfix 3.6.4alpine-38
: Postfix 3.3.0alpine-310
: Postfix 3.4.7alpine-312
: Postfix 3.5.16alpine-314
: Postfix 3.6.4alpine-316
: Postfix 3.7.6/var/log/postfix
: Log files when LOG_TO_STDOUT
is not set to 1
. Logs are not rotated on versions older than Postfix 3.4./var/spool/postfix
: Persist this volume to not lose state.MAILNAME
: /etc/mailname
and myhostname
Postfix configuration option are set to this value.MY_NETWORKS
: mynetworks
Postfix configuration option is set to this value. Default is 172.17.0.0/16 127.0.0.0/8
.MY_DESTINATION
: mydestination
Postfix configuration option is set to this value.
If you are not extending this Docker image to also deliver local (inside the container)
e-mails then you generally do not have to change the default.
Default is localhost.localdomain, localhost
.ROOT_ALIAS
: E-mail to which local (inside the container) e-mails to root
user
are send.
If you are not extending this Docker image you generally do not have to set this
as there are no e-mails send to the root
user from inside the container.LOG_TO_STDOUT
: If set to 1
output logs to stdout (retrievable using docker logs
) instead of log volumes. Available for Postfix 3.4 and newer.25/tcp
: SMTP port.465/tcp
: SMTPS port.587/tcp
: Mail submission port.Docker image providing Postfix.
You should make sure you mount spool volume (/var/spool/postfix
) so that you do not
lose e-mail data when you are recreating a container. If a volume is empty, image
will initialize it at the first startup.
When LOG_TO_STDOUT
is set to 1
, Docker image logs output to stdout and stderr. All stdout output is JSON.
By default it is configured for sending outbound e-mails. Otherwise, you can extend the image and configure it differently. See these examples:
Remember that for the best e-mail delivery external IP should match the hostname it resolves to. You might find tozd/external-ip Docker image useful for this.
If you are extending this image, you can add two scripts which will be run at a container startup:
/etc/service/postfix/run.config
– to prepare any custom configuration, before anything else is run/etc/service/postfix/run.initialization
– will be run after the container is initialized, but before the
Postfix daemon is runIf you just need programs inside your Docker images to send e-mails using sendmail
program
locally, consider using tozd/mailer or
tozd/nginx-mailer Docker image as your base.
This tozd/postfix
Docker image delivers e-mails to wide Internet by itself.
Then you can configure tozd/mailer
-based containers to relay e-mails to one tozd/postfix
container which then sends e-mails out.
There is also a read-only GitHub mirror available, if you need to fork the project there.
docker pull tozd/postfix