This is a Docker image for a Postfix/Dovecot mailserver. The project is part of the docker-mailserver project but can run separately without the other components. However, a database server is always required to store structural data. E-Mails itself are stored on file system.
Related images:
The following versions are available from DockerHub. The image tag matches the Postfix version.
docker-mailserver-postfix is licensed under GNU LGPL 3.0. As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
The following components must be available at runtime:
mailserver-postfix requires various environment variables to be set. The container startup will fail when the setup is incomplete.
| Variable | Description | Default Value |
|---|---|---|
PF_SETUP_PASS | The password of the database administrator (root). This value is required for the initial bootstrap only in order to setup the database structure. It can and shall be removed after successful setup. | |
PF_DB_HOST | The hostname or IP address of the database server | localhost |
PF_DB_USER | The name of the database user. Attention! You shall not use an administrator account. | postfix |
PF_DB_PASS | The password of the database user | password |
PF_DB_NAME | The name of the database | postfix |
PF_MYDOMAIN | The first and primary mail domain of this server. Postfix requires this for setup but you can configure multiple main domains. | localdomain |
PF_MYHOSTNAME | The hostname that Postfix uses to greet clients. | (name of host) |
PF_MYORIGIN | The domain to be used for local mails (usually name of host). | value of PF_MYHOSTNAME |
PF_AMAVIS_SERVICE_NAME | The hostname or IP address of an Amavis instance in order to fight spam and viruses. No AntiSpam and AntiVirus detection takes place when left empty | |
PF_AMAVIS_SERVICE_PORT | The port of the Amavis instance. | 10024 |
PF_MILTERS | Milters to be configured | |
PF_DKIM_SERVICE_NAME | Hostname or IP address of a DKIM service | |
PF_DKIM_SERVICE_PORT | Port of a DKIM service | 41001 |
PF_TLS_CERT_FILE | SSL server certificate for TLS. | /etc/ssl/certs/ssl-cert-snakeoil.pem |
PF_TLS_CERTCHAIN_FILE | SSL server certificate for TLS including certificate chain. | value of PF_TLS_CERT_FILE |
PF_TLS_KEY_FILE | Key file for SSL server certificate. | /etc/ssl/certs/ssl-cert-snakeoil.key |
PF_TLS_CAPATH | Directory that contains trusted CA root certificates. | /etc/ssl/certs |
PF_TLS_CAFILE | Name of single file that contains trusted CA root certificates. | /etc/postfix/CAcert.pem |
PF_TLS_ADMIN_EMAIL | E-mail address to be notified when TLS certificate is about to expire (10 days) | postmaster@$PF_MYDOMAIN |
You need to provide data volumes in order to secure your mailboxes from data loss.
/var/vmails is required to persist e-mails that are locally delievered to a mailbox/var/spool/postfix is required to hold e-mails that are currently in transmission (Postfix mail queues). Ensure that it is writable for all at startup so Postfix, Dovecot and syslog can create their directories. Afterwards you can reduce the permissions to user-writable only.Additional volumes are required to map your TLS certificate into the container.
docker-mailserver-postfix exposes 5 ports by default:
The main mailserver project has examples of container configurations:
Once you have started your Postfix container successfully, it is now time to perform the first-time setup for your mailserver. It is highly recommended to use docker-mailserver-postfixadmin for this purpose. However, you can use your own PostfixAdmin installation.
PF_MYDOMAINOnly two environment variables are required in order to secure your mailserver by TLS. PF_TLS_CERT_FILE and PF_TLS_KEY_FILE will ensure that mails can be sent to you in a secure way. However, bear in mind that these certificates expire. The system checks your TLS certificate every 24 hours and informs you by e-mail about the expiration. As the TLS variables hold path names only, it is required to map your certificate files into the running container using volumes.
You'll need to issue postconfig reload after you've changed the certificate.
You can further customize main.cf, master.cf and other Postfix configuration files. Please follow these instructions:
/usr/local/mailserver/templates folder for already existing customizations./etc/postfix folder./usr/local/mailserver/templates by using volume mappings./usr/local/mailserver/reset-server.sh. Then restart again.Here are some useful links that help you to test whether your new Mailserver works as intended and no security flaws are introduced:
This Docker image is mature and replaced my own mailserver in production. However, several issues are still unresolved:
Report a bug, request an enhancement or pull request at the GitHub Issue Tracker. Make sure you have checked out the Contribution Guideline
Content type
Image
Digest
Size
149.7 MB
Last updated
about 5 years ago
docker pull j1cs/postfix