Public | Automated Build

Last pushed: a year ago
Short Description
Modular mail service: Core module, see for more info
Full Description

Dockermail - Email Core

This image provides a secure, minimal mail server based on 'postfix' and 'dovecot'.

All incoming mail to your domains is accepted.
For outgoing mail, only authenticated (logged in with username and password) clients can send messages via STARTTLS.


You will need 2 folder on your host, one to store your configuration and another one to store your email. For example:

  • /opt/dockermail/settings
  • /opt/dockermail/vmail

These will be mounted into container and store settings and email on host.

All the configuration is done through a single config.json file, extra files (eg. SSL keys) will be stored in the settings directory for backup.
There is an example file in config/example to get you started.

Remember to restart your container if you update the settings!


  "settings": {
    "myhostname": ""
  "domains": {
    "" :
          "email": "",
          "password": "{PLAIN}SuperSecure123",
          "aliases": [""]
          "email": "",
          "password": "{SHA256-CRYPT}$5$ojXGqoxOAygN91er$VQD/8dDyCYOaLl2yLJlRFXgl.NSrB3seZGXBRMdZAr6"

The hash within config.json contains 2 primary keys: domains and settings.

  • myhostname - should be the fully qualified domain of the server hosting email. Although optional you will have problems with EHLO commands and amavis without it.


Each domain has an array of account objects, each account has the following keys:

  • email - email address of the account. Will also be used as the login.
  • password - password for the account. See below for details.
  • aliases - (Optional) Array of aliases to redirect to this account. For a catch-all use your domain with no account, eg: ``.
Generating passwords

Passwords have to be in a dovecot format.

A plain-text password looks like this: {PLAIN}SuperSecure123.

To get more secure hash values, you need to start the container and run:

docker exec -it [email_core_container_name] doveadm pw -s [scheme-name]

This will attach to a running container, prompt you for a password and provide a hash. For example:

> docker exec -it dockermail_core_1 doveadm pw -s SHA512-CRYPT
Enter new password:
Retype new password:

See Dovecot Wiki for more details on different schemes.


Using the pre-built image from docker hub, you can start your email by running:

docker run -name dockermail -d \
-p 25:25 -p 587:587 -p 143:143 -p 993:993 \
-v /opt/dockermail/settings:/mail_settings \
-v /opt/dockermail/vmail:/vmail \

This will connect SMTP ports 25/587 and IMAP port 143/993 to host and mount the folders as per examples given above.


Container will produce own SSL keys and back these up into the settings folder. These files are:


On boot it will use these if present. You can replace these backup keys with your own, just restart the container.

Docker Pull Command
Source Repository