Public | Automated Build

Last pushed: a year ago
Short Description
Update to catatnight/postfix image. see github for details.
Full Description

docker-postfix

Forked from catatnight/docker-postfix.

Contributions welcome.

Run postfix with smtp authentication (sasldb) in a docker container.
TLS and OpenDKIM support are optional (names for SSL certs needs to be passed in as env variables).

Requirement

  • Docker 1.0

Installation

  1. Build image

     $ sudo docker pull joofow/postfix
    

Usage

  1. Create postfix container with smtp authentication

     $ sudo docker run -p 25:25 \
             -h mail.example.com \
             -e maildomain=mail.example.com -e smtp_user=user:pwd \
             --name postfix -d catatnight/postfix
     # Set multiple user credentials: -e smtp_user=user1:pwd1,user2:pwd2,...,userN:pwdN
    
  2. Enable OpenDKIM: save your domain key .private in /path/to/domainkeys

     $ sudo docker run -p 25:25 \
             -e maildomain=mail.example.com -e smtp_user=user:pwd \
             -v /path/to/domainkeys:/etc/opendkim/domainkeys \
             --name postfix -d catatnight/postfix
    
  3. Enable TLS(587): save your SSL certificates example.pem and example_private_key.pem to /path/to/certs. Make sure the names of the certs are passed in as environment variables when running the container.

     $ sudo docker run -p 587:587 \
             -h mail.example.com \
             -e maildomain=mail.example.com -e smtp_user=user:pwd \
             -e cert_file=example.pem -e key_file=example_private_key.pem \
             -v /path/to/certs:/etc/postfix/certs \
             --name postfix -d catatnight/postfix
    
  4. You can combine all of the above methods

     $ sudo docker run -p 587:587 \
             -h mail.example.com \
             -e maildomain=mail.example.com -e smtp_user=user:pwd \
             -e cert_file=example.pem -e key_file=example_private_key.pem \
             -v /path/to/domainkeys:/etc/opendkim/domainkeys \
             -v /path/to/certs:/etc/postfix/certs \
             --name postfix -d catatnight/postfix
    

Note

  • Login credential should be set to (username@mail.example.com, password) in Smtp Client
  • You can assign the port of MTA on the host machine to one other than 25 (postfix how-to)
  • Read the reference below to find out how to generate domain keys and add public key to the domain's DNS records

Reference

Docker Pull Command
Owner
joofow
Source Repository