Self-host docker-mailserver
Mail Serverdeployed & timed by usprices checked · Jul 2026
A production-ready, config-driven mail server in a single container — Postfix, Dovecot, and Rspamd 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.
Google Workspace / yr$84
Self-hosted / yr~$55
You keep$29/yr
Pocket the difference — spin it up on a cheap VPS in minutes.Start free on Kamatera →
Key facts
CategoryMail Server
LicenseMIT
StackShell
Min RAM512 MB
Dockeryes
Difficulty
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
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.comdeploy guideHow to Deploy docker-mailserver on a VPSvps picksBest VPS for self-hostingbenchmarked quarterly · re-priced monthly
An alternative to
Head-to-head
More in Mail Server
Mail ServerMailcow
PHPShell
hardRead guide →
Mail ServerMailu
PythonShell
hardRead guide →
Mail ServerStalwart
Rust
hardRead guide →