Guide · Open source
How to use docker-mailserver: setup, services and key tips
Updated · written with AI from the project's own documentation and checked against our catalogue data
docker-mailserver is an open-source, containerized mail server that bundles SMTP, IMAP, anti-spam and anti-virus components into one package. This guide explains what it includes, what you need before you start, and how its file-based configuration works, so you know what to prepare before following the official setup documentation. It is written for readers who plan to run mail on a server they control.
Quick start
- 1Install Docker. Make sure Docker is installed and running on the host that will run the mail server, since Docker is the only listed prerequisite.
- 2Prepare DNS and certificates. Plan your mail domain's DNS records and choose a TLS certificate option such as LetsEncrypt, manual or self-signed.
- 3Read the docs for your version. Open the basic installation tutorial and the documentation that matches the image version you intend to use.
- 4Follow the initial setup. Follow the official documentation for initial setup, since the README does not include install commands.
- 5Configure accounts and settings. Edit the configuration files and use the setup script and environment variables described in the docs.
- 6Enable DKIM and DMARC. Set up OpenDKIM and OpenDMARC as described in the documentation so outgoing mail can be verified.
- 7Keep it updated. Follow the documented update process from the FAQ and keep the docs and image version in sync.
What docker-mailserver is and who it suits
docker-mailserver is a production-ready, fullstack but simple containerized mail server. Its README lists SMTP, IMAP, LDAP, anti-spam and anti-virus among its capabilities.
The project is aimed at people who want to run their own mail server on a machine they control, admins who already use Docker, and teams that want anti-spam, anti-virus and DKIM/DMARC handled in one package.
- Good fit: you operate the server yourself and already use Docker.
- Good fit: you prefer file-based configuration over a SQL database.
- Poor fit: you want hosted email with no servers to run.
- Poor fit: you want a managed service with support contracts. The README says the issue tracker is not for personal support.
What you need before installing
The only prerequisite listed in the source is Docker. Mail setup, however, involves more than Docker. The README points to documentation for initial setup, and the project's own description of the audience includes people who understand DNS, TLS certificates and mail deliverability.
Before you begin, make sure you are comfortable with DNS records, TLS certificates and how mail delivery is checked by other servers. Without that background, the setup steps will be hard to verify.
- Docker installed on the host.
- Control of the domain's DNS records.
- A plan for TLS certificates: LetsEncrypt, manual or self-signed are all supported.
- Read the documentation for your version before starting.
Understand the bundled services
docker-mailserver packages several mail components so you do not have to assemble them yourself. The main ones are Postfix for sending and receiving mail, and Dovecot for IMAP and POP3 access.
Filtering and security are handled by the included services: Rspamd, SpamAssassin, Amavis, ClamAV for virus scanning, OpenDKIM and OpenDMARC for DKIM and DMARC, Fail2ban, Postscreen and Postgrey.
- Postfix: SMTP sending and receiving, with SMTP or LDAP authentication.
- Dovecot: SASL, IMAP, POP3, LDAP, basic Sieve support and quotas.
- Rspamd, SpamAssassin and Amavis: spam and content filtering.
- ClamAV: anti-virus with automatic updates.
- OpenDKIM and OpenDMARC: DKIM and DMARC handling.
- Fail2ban, Postscreen and Postgrey: blocking and connection screening.
- Fetchmail and Getmail6: retrieving mail from other accounts.
Configure with files, not a database
The project keeps configuration in files rather than a SQL database. The README says this keeps the server simple, versioned and easy to deploy and upgrade.
The source also provides a setup script for configuration and maintenance, and documents environment variables and account management. Check the linked documentation for the exact file names and options for your version.
- Configuration lives in files you can keep under version control.
- A setup script is provided for configuration and maintenance.
- Environment variables are documented on the project site.
- Match the documentation version to the image version you run.
Where to find the exact setup steps
The README does not include install commands. It directs you to the documentation, which covers initial setup, usage, environment variables, account management and updating. The example tutorial linked from the README is titled basic installation.
Because the project warns that documentation must match the image version, read the page for the version you plan to run and follow it from start to finish.
- Basic installation tutorial: docker-mailserver.github.io/docker-mailserver/latest/examples/tutorials/basic-installation/
- FAQ, including how to update: docker-mailserver.github.io/docker-mailserver/latest/faq/
- Environment variables: docker-mailserver.github.io/docker-mailserver/latest/config/environment/
- Issues and contributing: docker-mailserver.github.io/docker-mailserver/latest/contributing/issues-and-pull-requests/
Troubleshoot before opening an issue
The README asks users to search the documentation for their version before opening an issue. Issues are for bugs and problems with the project, not for personal help with your setup.
If something fails, check the FAQ and the docs for your image version first.
- Search the documentation for your exact version.
- Confirm the docs match the image tag you are running.
- Open an issue only for a reproducible problem with the project.
What people use it for
- Running a self-hosted mail server for a small domain on a machine you control.
- Hosting mailboxes for a team that already runs services in Docker.
- Adding spam and virus filtering in front of an existing mail setup.
- Retrieving mail from other accounts with Fetchmail or Getmail6.
- Managing mail with file-based configuration kept in version control.
Frequently asked questions
Is docker-mailserver free to use?
docker-mailserver is released under the MIT licence, as stated in the project information. You are responsible for the server, domain and any infrastructure you run it on.
What do I need to run docker-mailserver?
The source lists Docker as the prerequisite. You also need control of your DNS and a plan for TLS certificates, since mail setup depends on them.
Does docker-mailserver include anti-spam and anti-virus?
Yes. The bundled services include Rspamd, SpamAssassin, Amavis, ClamAV for virus scanning, and Fail2ban among others.
Does docker-mailserver use a database?
No. The project says it uses only configuration files and no SQL database, which it describes as keeping setup simple and versioned.
Where are the install instructions?
The README does not include install commands. It points to the official documentation, including a basic installation tutorial, which you should follow for the version you run.
How does docker-mailserver compare with Mailu, Mailcow or iRedMail?
The source lists Mailu, Mailcow and iRedMail as comparable projects but does not compare features or performance. Evaluate them against your own needs and read each project's documentation.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
docker-mailserver suits admins who already use Docker and want to run a full, self-operated mail server with filtering and DKIM/DMARC bundled together. It is a poor choice if you want hosted email, have no experience with DNS, TLS or deliverability, or need vendor support.
Install options & downloads