To run without any configuration:
docker run -d -p 25:25 bernardolins/postfix
Extra configuration is provided through environment variables.
When your users are stored on your own system (a normal unix user, listed on /etc/passwd), they will be able to receive mails from the local domains of you server. So, if you server's local domain is domain.com and you have an user bob, he will receive messages as [email protected], and these messages are stored on /var/mail/bob (or somewhere else you choose). Local domains are configurable using postfix's mydestination entry. Since it makes no sense to create local users inside a docker container, that option is not configurable on this image.
When using virtual mailbox domains, you do not use a normal system user, like in local domains. Instead, you use postfix's virtual_mailbox_domains to specify a list of domains you accept emails for. Also, you can tell postfix to look on a mapping (2 columns), which stores the user's email address and mailbox directory, through virtual_mailbox_maps.
Those mappings can be stored on a database, like LDAP or MySQL, or on text files, that need to be converted using postmap command. This image supports LDAP as storage database for virtual mailboxes maps and uses textfiles to configure virtual domains. You just need to define $MYHOSTNAME and $MYDOMAIN variables and the configuration script will add these entries as virtual domains.
If you choose just to foward messages to another address, you can tell postfix to tell certain domains as aliases. Like virtual domains, you need to setup a mapping with two columns: the first one is the alias and the second one is the fowarding address.
For more information about virtual domains and aliases, take a look at postfix page
Just drop you ldap configuration at /config/ldap and the configuration script will tell postfix to use it automatically to search for virtual mailboxes.
FROM bernardolins/postfix
ADD ldap.conf /config/ldap/
For more information about LDAP and postfix, take a look at postfix's documentation about LDAP.
Spammers often send messages in the name of another user, turning your server into an open relay. To avoid that, you should configure SMTP authentication.
This image supports this kind of authentication. You just need to define $SASL_HOST (IP:PORT) and SASL_TYPE (cyrus or dovecot). Ex: SASL_HOST=192.168.0.19:12345
Ips defined on this variable can send emails without authentication. Setup multiple ips separated by comma. Ex: MYNETWORKS=192.168.0.19,192.168.0.20
This image uses LMTP to exchange emails between postfix and the MDA (like dovecot). You should tell the MDA to listen LMTP connections on a port (see dovecot guide). This image's postfix you connect on i**$LMTP_HOST** (IP:PORT) and use this connection to deliver messages to MDA.
Important: If one of theses variables are not set, postfix will not deliver messages to MDA!
Content type
Image
Digest
sha256:4129624d2…
Size
94.2 MB
Last updated
almost 11 years ago
docker pull bernardolins/postfix