docker-mailserver
Your own mail server as a container. Postfix + Dovecot + Rspamd + ClamAV, fully configured, live in 1–2 days. A concrete alternative to Strato, Ionos and Google Workspace for SMBs that take mail sovereignty seriously.
Project profile
docker-mailserver
Production-ready full-stack mail server
As of: June 1, 2026
GitHub stars
18k
Forks
2.0k
Open issues
107
License
MIT
Latest version
v15.1.0
Language
Shell
What is docker-mailserver?
docker-mailserver is a pre-configured mail suite in a container: Postfix as the SMTP server, Dovecot as the IMAP server, Rspamd as a modern spam filter, ClamAV for attachment scanning, against brute force, OpenDKIM/SPF/DMARC for mail authentication. Everything from one source, everything administrable through one setup script.
Unlike Mailcow (an 11-container stack with its own UI), docker-mailserver is leaner: one container plus optionally a webmail surface (Roundcube, SOGo). MIT licensed, running in production since 2015, with a very active community and detailed documentation.
Why an engineering firm self-hosts its mail server
For an engineering firm with 30–50 active building projects, email is the lifeline: client correspondence, architect coordination, authority enquiries, subcontractor deliveries. Strato or Ionos mail works, but has three hard limits: typically only 20–50 aliases per domain, an average spam filter, no catch-all possible.
With your own mail server: unlimited aliases (project-2026-007@, project-2026-008@ per building project), Rspamd with Bayes learning trained by sales support filters better than any commercial filter after six months, catch-all for the domain lets you receive any address you can imagine. Plus: mail data stays in German legal space on your own .
Client case study
Statisches Büro Möllers
Engineering office for structural design, 8 people — owner Thomas Möllers, 2 structural engineers, 2 site managers, 1 designer, 2 sales support. 30–50 active building projects, on average 150 incoming emails per day. 14 months ago migrated from Strato web hosting to their own mail server on a Hetzner . Today: 0 spam complaints, 0 lost mail, 100 % mail sovereignty.
Unlimited project aliases
A spam filter that actually works
GDPR-compliant mail routing
Webmail for browser access
Anti-phishing for subcontractor mail
10-year archive
What the mail server actually delivers
Eight productive configuration patterns from 14 months of Möllers operation. Each replaces a sequence from the pre-Strato era that hosted mail either could not do or only with limits.
Catch-all for project aliases
Rspamd with Bayes learning
DKIM/SPF/DMARC properly configured
SOGo webmail + calendar + contacts
Fail2ban against brute force
ClamAV quarantine for attachments
Postfix routing for lists
10-year archive on NAS
Core capabilities of docker-mailserver
What the software offers as a mail stack — and which capabilities actually carry an 8-person setup.
Postfix + Dovecot production setup
Rspamd instead of SpamAssassin
ClamAV for attachment scanning
DKIM/SPF/DMARC + Fail2ban
SOGo / Roundcube optional
setup.sh for every admin task
Honest alternatives
If docker-mailserver is not a fit — what else?
Three alternatives for SMB mail sovereignty. Each with its own trade-off between control, comfort and effort.
All-in-one stack
Mailcow
SerNet, GPL-3.0
- + Complete web UI for mail administration
- + SOGo + Sieve editor + quarantine integrated
- − 11 containers, higher complexity
- − RAM footprint ~2 GB
Script based
Mail-in-a-Box
Joshua Tauberer, CC0
- + One-command setup on Ubuntu
- + Very simple initial install
- − Less flexible, no container
- − Updates manual and less frequent
SaaS hosted mail
Strato/Ionos/Workspace
Various, proprietary
- + No own server, no setup
- + Ready-made mobile apps + web UI
- − Limited aliases, catch-all rarely possible
- − Mediocre spam filter, no Bayes training
Rule of thumb: anyone who wants control over the setup (DKIM keys, Postfix logs) and has IT-affine staff or consulting support is pragmatic on docker-mailserver. Anyone who wants a complete web UI for mail administration and is not afraid of 11 containers picks Mailcow. Hosted mail remains sensible when mail sovereignty is not the top concern.
Pricing
MIT. Postfix standard. No asterisks.
License
MIT — classic OSI open-source license without strings. Read the source, modify, use commercially — all permitted. Postfix, Dovecot, Rspamd themselves are also MIT or similarly permissively licensed.
Running costs
One VPS with its own IP (Hetzner CPX21 from €7/month in Falkenstein), DNS at Hetzner or your own provider. RAM footprint around 700 MB for 8 mailboxes + SOGo. Storage: 1–5 GB per mailbox depending on mail volume.
Effort
Initial setup: 1–2 days including DNS configuration (MX, SPF, DKIM, DMARC), mailbox creation, webmail container, migration of existing mail via IMAP sync. Full SMB setup with backup routine and staff training: 3–5 consulting days.
Important for clarity: running your own mail server needs either an IT-affine staff member or a consulting contract that steps in on issues. Anyone reluctant is better off with hosted mail. The last tagged release is from August 2025 — active development happens via the `:latest` tag with regular image updates. Stable for over 10 years.
setup.sh — account, alias, DKIM in 3 commands
# Create mail account
docker exec -ti mailserver setup email add \
thomas.moellers@engineering-firm.com \
${ACCOUNT_PASSWORD}
# Alias for a project address
docker exec -ti mailserver setup alias add \
project-2026-007@engineering-firm.com \
thomas.moellers@engineering-firm.com
# Generate DKIM key (publish in DNS!)
docker exec -ti mailserver setup config dkim
# → returns TXT record for mail._domainkey.engineering-firm.com
# Check status
docker exec -ti mailserver setup debug fail2ban
docker exec -ti mailserver setup debug login thomas.moellers@...docker-mailserver setup as Docker Compose
services:
mailserver:
image: ghcr.io/docker-mailserver/docker-mailserver:15.1.0
container_name: mailserver
hostname: mail.engineering-firm.com
restart: always
ports:
- "25:25"
- "143:143"
- "465:465"
- "587:587"
- "993:993"
volumes:
- ./mail-data:/var/mail
- ./mail-state:/var/mail-state
- ./mail-logs:/var/log/mail
- ./config:/tmp/docker-mailserver
- /etc/letsencrypt:/etc/letsencrypt:ro
environment:
- SSL_TYPE=letsencrypt
- ENABLE_RSPAMD=1
- ENABLE_CLAMAV=1
- ENABLE_FAIL2BAN=1
- ENABLE_OPENDKIM=0
- SPOOF_PROTECTION=1
- PERMIT_DOCKER=none
cap_add:
- NET_ADMIN
networks:
- mail-net
networks:
mail-net:Related topics
A mail server needs a platform and monitoring
as the platform, Caddy as the HTTPS layer for webmail, for IMAP/SMTP monitoring:
Ready for the next step?
Free intro call, no strings attached. In 30 minutes you'll know whether and how AI can help your business.