HUB
Sign inSign up
postfix logo

webkutir/postfix

By webkutir

•Updated 11 days ago

Docker image for Postfix 3.11.7 and Dovecot on Ubuntu 26.10.

Image
Networking
0

1.4K

webkutir/postfix repository overview

Postfix and Dovecot for virtual mailboxes stored in MySQL. Mail is delivered over LMTP into Maildir, and clients sign in through Dovecot.

⁠Image

  • Base image: ubuntu:26.10
  • Postfix 3.11.7, with the MySQL map package
  • Dovecot IMAP, POP3, and LMTP
  • IPv4 only
  • Container timezone Asia/Dhaka
  • Mailboxes are stored at /var/vmail/domain/user@domain
  • Dovecot requires TLS 1.2 or newer. Plaintext login is disabled
  • Postfix relays mail for 127.0.0.0/8 and for SASL-authenticated users
  • Incoming mail is checked with SPF and Spamhaus
  • Milters run in this order: Rspamd when it is configured, then OpenDKIM, then OpenDMARC. If a milter is down, mail is deferred
  • Submission on ports 465 and 587 is marked ORIGINATING so OpenDKIM signs it

TLS certificates are read from ${CERT_LOCATION}/${PF_HOSTNAME}/fullchain.pem and key.pem. CERT_LOCATION defaults to /etc/nginx/certs.

Mount /var/vmail if mailboxes should survive a new container.

⁠Ports

PortService
25SMTP
465SMTPS
587Submission
143IMAP
993IMAPS
110POP3
995POP3S

⁠Required environment

VariablePurpose
PF_HOSTNAMEPublic mail hostname. Also the certificate directory name
PF_DOMAINMail domain written to /etc/mailname
PF_DB_HOSTMySQL host
PF_DB_USERMySQL user
PF_DB_PASSMySQL password
PF_DB_NAMEMySQL database, normally the PostfixAdmin database
PF_DKIM_SERVICE_NAMEOpenDKIM host or IP
PF_DKIM_SERVICE_PORTOpenDKIM port
DMARC_SERVICE_NAMEOpenDMARC host or IP
DMARC_PORTOpenDMARC port

⁠Optional environment

VariablePurpose
PF_RSPAMD_SERVICE_NAMERspamd host or IP. Omit it to skip Rspamd
PF_RSPAMD_PORTRspamd port
CERT_LOCATIONDirectory that contains the certificate folder. Default: /etc/nginx/certs
PF_DAILY_REPORT_RECEIVER_EMAILAddress that receives the daily mail report
PF_DAILY_REPORT_SENDERMailbox name only, such as support. The domain is always PF_DOMAIN. Default: support

⁠Run

docker run -d --name postfix \
  -p 25:25 -p 465:465 -p 587:587 \
  -p 143:143 -p 993:993 -p 110:110 -p 995:995 \
  -e PF_HOSTNAME=mail.example.com \
  -e PF_DOMAIN=example.com \
  -e PF_DB_HOST=mariadb \
  -e PF_DB_USER=postfix \
  -e PF_DB_PASS=change-me \
  -e PF_DB_NAME=postfix \
  -e PF_DKIM_SERVICE_NAME=opendkim \
  -e PF_DKIM_SERVICE_PORT=41001 \
  -e DMARC_SERVICE_NAME=opendmarc \
  -e DMARC_PORT=10020 \
  -e PF_DAILY_REPORT_SENDER=support \
  -e [email protected] \
  -v mail-data:/var/vmail \
  -v certs:/etc/nginx/certs:ro \
  webkutir/postfix:3.11.7

⁠Daily report

When PF_DAILY_REPORT_RECEIVER_EMAIL is set, startup writes /send-my-report.sh. The script sends yesterday’s Postfix summary. The date is calculated in the container timezone, Asia/Dhaka. The sender is PF_DAILY_REPORT_SENDER plus @ plus PF_DOMAIN. With the example above, that is [email protected], and the recipient is [email protected].

The schedule is a crontab on the Docker host. This runs the report every day at 06:15 host time:

sudo bash -c '(crontab -l 2>/dev/null | grep -v send-my-report.sh; echo "15 6 * * * docker exec postfix /send-my-report.sh") | crontab -'

Confirm it with:

sudo crontab -l
Tag summary
Recent tags
Content type
Image
Digest
sha256:d9a32f54e…
Size
143.2 MB
Last updated
11 days ago
docker pull webkutir/postfix:latest