This docker container is aimed to run Postfix and Docker as email server. Inside your application you can receive and manage emails using Dovecot server.
To create email addresses you need MySQL database with tables; add email domains into mail_virtual_domains
, add email users to mail_virtual_users
.
docker pull davert/mailserver
docker build -t mailserver .
It is recommended to add environment vars (see below) into your Dockerfile to inject them on build.
Container requires access to mysql socket and directory to store emails. It also exposes email ports
docker run -i -t -e APP_HOST=example.com -e DB_NAME=dbname -p 25:25 -p 110:110 -p 143:143 -p 995:995 -p 587:587 -v /var/run/mysqld/:/var/run/mysqld -v /home/vmail:/home/vmail/ mailserver
/var/run/mysqld/:/var/run/mysqld/
- MySQL socket/home/vmail/:/home/vmail/
- directory to store emails