Docker-Mailserver

Docker-Mailserver

Docker app from Kulisch's Repository

Overview

A production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.). Only configuration files, no SQL database. Keep it simple and versioned. Easy to deploy and upgrade.

h3 Preperations /h3
This short guide will help you to set up a mailserver.

To keep the mailserver running, there are some important points to consider, like at least one configured mail account, SSL type, hostname, etc.

If these points are missing, they will be mentioned in the Docker logs to simplify troubleshooting.

Make sure, you got an domain and a static IP adress to setup your mailserver.
MX and A DNS entries are needed. After that, portforward the mentioned ports in your router.
h3 Initial steps: /h3

The following placeholders will be used:

b user /b is the mail account you create.

b example.com /b is the domain you are using.

b mail.example.com /bis the FQDN of the mailserver.

b password /bis the password for your mail account./b

  1. At first, setup the b environment variables /b and change b--hostname mail.example.com /b in the b Extra Parameters (advanced view)/b as needed.

Choose custom b Network Type /b and set an fixed IP Adress. (didn't tested other options)

  1. Create an e-mail account by starting the container with bPost arguments /b (advanced view):

bsetup email add user@example.com 'password'/b

bsetup email add admin@company.org 'Ch33rs#M8!' /b (for example)

  1. b Remove the post arguments. /b

  2. Start container and check the logs.

Optional and recommended: Open Container Console and type in...

bsetup config dkim/b

  1. Try to connect to the server with an e-mail client.

  2. Test sending and recieving mails

Optional: If everything works, you can enable bFail2Ban/b in the environment variables

For further informations, visit the extended documention:

https://docker-mailserver.github.io/docker-mailserver/edge/

Docker Mailserver

ci::status docker::pulls documentation::badge

:page_with_curl: About

A production-ready fullstack but simple containerized mail server (SMTP, IMAP, LDAP, Anti-spam, Anti-virus, etc.).

  • Only configuration files, no SQL database. Keep it simple and versioned. Easy to deploy and upgrade.
  • Originally created by @tomav, this project is now maintained by volunteers since January 2021.

[!TIP] Be sure to read our documentation. It provides guidance on initial setup of your mail server.

[!IMPORTANT] If you have issues, please search through the documentation for your version before opening an issue.

The issue tracker is for issues, not for personal support.
Make sure the version of the documentation matches the image version you're using!

:link: Links to Useful Resources

  1. FAQ
  2. Usage
  3. Examples
  4. Issues and Contributing
  5. Release Notes
  6. Environment Variables
  7. Updating

:package: Included Services

Install Docker-Mailserver on Unraid in a few clicks.

Find Docker-Mailserver in Community Apps on your Unraid server, review the template, and click Install. Unraid handles the Docker app or plugin setup from the published template.

Open the Apps tab on your Unraid server Search Community Apps for Docker-Mailserver Review the template variables and paths Click Install

Categories

Download Statistics

11,986,232
Total Downloads
125,729
This Month
115,022
Avg / Month

Total Downloads Over Time

Loading chart...

Related apps

Explore more like this

Explore all

Details

Repository
mailserver/docker-mailserver:latest
Last Updated2026-06-26
First Seen2022-04-27

Runtime arguments

Network
bridge
Shell
bash
Privileged
false
Extra Params
--hostname mail.example.com --restart=unless-stopped --cap-add=NET_ADMIN --cap-add=SYS_PTRACE

Template configuration

Port: SMTPPorttcp

SMTP (explicit TLS => STARTTLS) Port

Target
25
Default
25
Value
25
Port: IMAP4Porttcp

IMAP4 (explicit TLS => STARTTLS) Port

Target
143
Default
143
Value
143
Port: ESMTPPorttcp

ESMTP (implicit TLS) Port

Target
465
Default
465
Value
465
Port: ESMTP (SSL)Porttcp

ESMTP (explicit TLS => STARTTLS) Port

Target
587
Default
587
Value
587
Port: IMAP4 (SSL)Porttcp

IMAP4 (implicit TLS) Port

Target
993
Default
993
Value
993
MailsPathrw

/var/mail/

Target
/var/mail/
Default
/mnt/user/appdata/dms/mail-data/
Value
/mnt/user/appdata/dms/mail-data/
Mail statePathrw

/var/mail-state/

Target
/var/mail-state/
Default
/mnt/user/appdata/dms/mail-state/
Value
/mnt/user/appdata/dms/mail-state/
Log filesPathrw

/var/log/mail/

Target
/var/log/mail/
Default
/mnt/user/appdata/dms/mail-log/
Value
/mnt/user/appdata/dms/mail-log/
ConfigPathrw

/tmp/docker-mailserver/

Target
/tmp/docker-mailserver/
Default
/mnt/user/appdata/dms/config/
Value
/mnt/user/appdata/dms/config/
SSL TypeVariable

bempty/b = SSL disabled b (NOT recommended)/b bletsencrypt/b = Enables Let's Encrypt certificates b (/etc/letsencrypt/live/example.com/) /b bcustom/b = Enables custom certificates bmanual/b = Let's you manually specify locations of your SSL certificates for non-standard cases bself-signed/b= Enables self-signed certificates If bemtpy/b is b not /b choosen, go to = Show more settings...

Target
SSL_TYPE
Mount SSL PathPathrw

bMounting path/b where certs are stored If bletsencrypt/b is choosen as bSSL Type/b, then path structure bmust/b look like this: Host: /mnt/user/appdata/.../letsencrypt/ Container: /etc/letsencrypt/

Target
/etc/letsencrypt/
Key pathVariable

This is only supported with b`SSL_TYPE=manual`/b. Provide the path to your bkey/b file that you've mounted access to within the container. Example: /etc/letsencrypt/live/example.com/privkey.pem

Target
SSL_KEY_PATH
Cert PathVariable

This is only supported with b`SSL_TYPE=manual`/b. Provide the path to your bcert/b file that you've mounted access to within the container. Example: /etc/letsencrypt/live/example.com/fullchain.pem

Target
SSL_CERT_PATH
PostgreyVariable

Greylist <br> 1 = Enable <br> 0 = Disable

Target
ENABLE_POSTGREY
Default
0
Value
1
Fail2BanVariable

Fail2Ban <br> 1 = Enable <br> 0 = Disable

Target
ENABLE_FAIL2BAN
Default
0
Value
0
ClamAVVariable

ClamAV <br> 1 = Enable <br> 0 = Disable

Target
ENABLE_CLAMAV
Default
1
Value
1
Max mail sizeVariable

empty => 10240000 (~10 MB)

Target
POSTFIX_MESSAGE_SIZE_LIMIT
Default
10240000
Value
10240000
LocaltimePathro

Localtime

Target
/etc/localtime
Default
/etc/localtime
Value
/etc/localtime
SPAMASSASSINVariable

Spamassassin <br> 1 = Enable <br> 0 = Disable

Target
ENABLE_SPAMASSASSIN
Default
1
Value
1
Single state directoryVariable

0 => mail state in default directories <br> 1 => consolidate all states into a single directory (`/var/mail-state`) to allow persistence using docker volumes

Target
ONE_DIR
Default
1
Value
1
Spam to inboxVariable

deliver spam messages in the inbox <br> 1 = Enable <br> 0 = Disable

Target
SPAMASSASSIN_SPAM_TO_INBOX
Default
0
Value
1
Port: ManagesievePorttcp

Managesieve

Target
4190
Default
4190
Value
4190
ManagesieveVariable

Managesieve <br> 1 = Enable <br> 0 = Disable

Target
ENABLE_MANAGESIEVE
Default
0
Value
1