Running Your Own Mail Server Without Losing Your Mind
Setting up a mail server is one of those things that sounds reasonable until you actually try it. You end up juggling Postfix configs, Dovecot sockets, spam filters, and certificate renewals—and that's before you've sent a single email. Docker Mailserver takes a different approach: it packages the whole stack into a container and lets you configure it with files instead of a database.
What It Does
Docker Mailserver is a production-ready, fullstack containerized mail server. It bundles SMTP, IMAP, LDAP, anti-spam, and anti-virus into a single image, so you don't have to wire those pieces together yourself. The project was originally created by @tomav and has been maintained by volunteers since January 2021.
The key architectural decision is right there in the description: only configuration files, no SQL database. That means your mail server's state lives in plain files you can version, diff, and back up like any other config. It's meant to be simple to deploy and upgrade, and there's a setup script included for configuration and maintenance tasks.
Under the hood, you get Postfix handling SMTP with LDAP authentication and extension delimiters, Dovecot handling SASL, IMAP, POP3, LDAP, Sieve, and quotas, plus Rspamd, Amavis, SpamAssassin (with custom rule support), and ClamAV with automatic updates. Rounding it out are OpenDKIM, OpenDMARC, Fail2ban, Fetchmail, Getmail6, Postscreen, and Postgrey. Certificates are handled via LetsEncrypt, manual, or self-signed options, and OAuth2 authentication is supported through the XOAUTH2 or OAUTHBEARER SASL mechanisms.
Why It's Cool
-
No database is the whole point. Most mail server setups accumulate state in MySQL or Postgres, which means another service to run, back up, and migrate. Here, everything is files. You can keep your configuration in git, review changes in pull requests, and roll back by checking out an older commit. That's a genuinely different operational model for mail.
-
The stack is already assembled. You don't have to research which combination of Postfix, Dovecot, and spam filtering actually works together. The README lists a fairly complete set of components—anti-spam, anti-virus, DKIM, DMARC, greylisting, fail2ban—and they ship in one image with a setup script to manage them.
-
Certificate handling covers the realistic cases. LetsEncrypt is supported, but so are manual and self-signed certificates. If you're running this on an internal network or behind something else that terminates TLS, you aren't forced into one path.
-
OAuth2 support is a nice touch. Supporting XOAUTH2 and OAUTHBEARER SASL mechanisms means you can work with modern authentication flows, which matters if you're integrating with providers that have moved past plain passwords.
-
It's been maintained for a while. The project has been community-run since 2021 and has a dedicated documentation site with version-specific guidance—which suggests the maintainers take the long tail of configuration questions seriously.
The honest caveat: running mail is still running mail. This container makes the software stack manageable, but DNS records, reverse proxies, and deliverability are still on you. The README is upfront about pointing you to documentation before opening issues, and that's a good sign—it means the project expects you to do some reading.
How to Try It
The README doesn't include a copy-paste install command, so the practical starting point is the documentation site. Here's a reasonable path:
-
Read the documentation first. The README explicitly recommends this for initial setup guidance, and it's organized by version—make sure the docs version matches the image version you pull.
-
Pull the image from Docker Hub:
docker pull mailserver/docker-mailserver -
Work through the basic installation tutorial to get a working setup.
-
Use the setup script for account and configuration management once the container is running.
-
Check the FAQ and environment variables reference when you need to tune behavior.
The repository is at github.com/docker-mailserver/docker-mailserver, and release notes live in the CHANGELOG if you want to see what's changed between versions.
Final Thoughts
Docker Mailserver is best suited to developers and small teams who want a self-hosted mail server without adopting a full database-backed mail platform. If you already manage infrastructure as code and appreciate configuration you can version, the file-only approach will feel natural. If you want a mail server you can install and forget about, this isn't that—but no mail server is. The takeaway is that the project removes a lot of the assembly work while leaving you in control of the configuration, which is a reasonable trade for anyone who's ever stared down a Postfix main.cf.
Follow @githubprojects for more developer tools and open source projects.