Self-host docker-mailserver
A production-ready, config-driven mail server in a single container — Postfix, Dovecot, and a choice of Amavis/SpamAssassin or Rspamd antispam, with no database and no web UI, configured entirely from plain files. A lightweight, MIT-licensed self-hosted alternative to Google Workspace email. As with any self-hosted mail, expect to manage deliverability (SPF, DKIM, DMARC, and reverse DNS) so your mail reaches inboxes.
Key facts
Pick docker-mailserver when you want a mail server you administer from a shell, not a browser: one MIT-licensed container of Postfix, Dovecot, Rspamd, Amavis, SpamAssassin, ClamAV, OpenDKIM/OpenDMARC and Fail2ban, configured entirely through `mailserver.env` and the bundled `setup` script — "only configuration files, no SQL database". It has the smallest RAM floor in this hub and is the easiest to version-control, and it is the least forgiving if you expected a web UI: there isn't one.
Follow the docker-mailserver deploy guide →What you need
- Any VPS with at least 512 MB of RAM
- A domain you control — most self-hosted setups need HTTPS in front of them
- About the better part of a day
Paid link — we earn a commission if you shop through it.
Install
Run these commands on your server:
# docker-mailserver — single container, no web UI; config from plain files
DMS_URL="https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master"
wget "${DMS_URL}/compose.yaml" && wget "${DMS_URL}/mailserver.env"
# Replace the hostname: mail.example.com line in compose.yaml with your
# own FQDN first — it ships as a placeholder and becomes your SMTP banner.
docker compose up -d && docker exec -ti mailserver setup email add user@example.comWhat you take on
docker-mailserver ships with almost everything off; the defaults in `mailserver.env` decide what you actually get: