Stalwart vs docker-mailserver: Full Comparison
The Short Answer
If you want a web admin UI and modern protocols like JMAP, pick Stalwart. If you want a proven Postfix/Dovecot stack you manage entirely through config files and CLI, pick docker-mailserver. Both handle production email reliably — the real question is whether you prefer a single Rust binary with a dashboard or a traditional Linux mail stack you can debug with decades of community knowledge.
What Each Server Actually Is
Stalwart is a ground-up rewrite of email serving in Rust. One binary handles SMTP, IMAP, POP3, JMAP, CalDAV, and CardDAV with an embedded RocksDB database. No external dependencies — no PostgreSQL, no Redis, no separate components. It ships with a web admin UI for managing accounts, domains, and spam rules. The project is newer (first stable release in 2023) but iterates fast. stalw.art
docker-mailserver bundles the traditional Linux mail stack — Postfix for SMTP, Dovecot for IMAP/POP3, OpenDKIM for signatures, Rspamd or SpamAssassin for filtering, optional ClamAV for antivirus — into a single Docker container. All management happens through the setup.sh CLI or configuration files. No web UI. The project has been around since 2016 and is one of the most widely deployed self-hosted mail solutions. github.com/docker-mailserver
Feature Comparison
| Feature | Stalwart v0.15.5 | docker-mailserver 15.1.0 |
|---|---|---|
| Language | Rust | Postfix (C), Dovecot (C), glue scripts |
| Web admin UI | Yes (built-in) | No — CLI only (setup.sh) |
| SMTP | Yes | Yes (Postfix) |
| IMAP | Yes | Yes (Dovecot) |
| POP3 | Yes | Yes (Dovecot) |
| JMAP | Yes | No |
| CalDAV/CardDAV | Yes (built-in) | No |
| Spam filtering | Sieve + built-in filter | Rspamd or SpamAssassin |
| Antivirus | No built-in | ClamAV (optional, adds ~1 GB RAM) |
| DKIM signing | Built-in | OpenDKIM |
| Fail2ban | Built-in rate limiting | Fail2ban included |
| Full-text search | Yes (built-in) | Dovecot FTS with Solr (optional) |
| Encryption at rest | Yes (AES-256) | No built-in |
| Database | Embedded RocksDB | Filesystem (Maildir) |
| External DB support | PostgreSQL, MySQL, SQLite, LDAP | LDAP (optional) |
| Containers needed | 1 | 1 |
| License | AGPL-3.0 | MIT |
Setup Complexity
Stalwart is arguably the easiest self-hosted mail server to deploy:
services:
stalwart:
image: stalwartlabs/stalwart:v0.15.5
container_name: stalwart
ports:
- "25:25"
- "465:465"
- "587:587"
- "143:143"
- "993:993"
- "443:443"
- "8080:8080"
volumes:
- stalwart-data:/opt/stalwart
restart: unless-stopped
volumes:
stalwart-data:
Start it, open the web UI on port 8080, and configure domains and accounts through the browser. DNS records (MX, SPF, DKIM, DMARC) still need manual setup, but the UI tells you exactly what to add.
docker-mailserver requires more upfront configuration:
services:
mailserver:
image: ghcr.io/docker-mailserver/docker-mailserver:15.1.0
container_name: mailserver
hostname: mail.example.com
env_file: mailserver.env
ports:
- "25:25"
- "465:465"
- "587:587"
- "143:143"
- "993:993"
volumes:
- ./dms-data:/var/mail
- ./dms-state:/var/mail-state
- ./dms-logs:/var/log/mail
- ./dms-config:/tmp/docker-mailserver
- /etc/localtime:/etc/localtime:ro
cap_add:
- NET_ADMIN
- SYS_PTRACE
restart: unless-stopped
You create accounts via CLI (setup.sh email add [email protected]), configure environment variables in mailserver.env, and manage everything from the terminal. The documentation is excellent, but there’s no “click through a wizard” path.
Resource Usage
| Resource | Stalwart | docker-mailserver |
|---|---|---|
| RAM (idle) | 150–300 MB | 400–600 MB (without ClamAV) |
| RAM (with antivirus) | N/A | 1.5–2 GB (with ClamAV) |
| CPU (idle) | Minimal | Minimal |
| Disk (base) | ~200 MB | ~500 MB |
| Disk (with ClamAV) | N/A | ~1.5 GB |
Stalwart is lighter because everything is compiled into one binary. docker-mailserver runs multiple processes (Postfix, Dovecot, Rspamd, OpenDKIM, etc.), each with its own memory footprint.
Debugging and Community Support
This is where docker-mailserver has a significant advantage. Every component it uses — Postfix, Dovecot, Rspamd — has decades of documentation, Stack Overflow answers, and blog posts. When something breaks, you’re debugging well-known software with well-known tools (postqueue -p, doveadm, rspamc).
Stalwart’s Rust codebase is newer and less documented. The community is growing but smaller. When something breaks, you’re more likely to need the official docs or GitHub issues. The web UI makes common operations easier, but edge cases may require digging into TOML config files with less community guidance available.
Migration
Both servers store mail in standard formats that can be migrated with imapsync or similar IMAP migration tools. Moving between them is straightforward — point imapsync at the old server’s IMAP and the new server’s IMAP, and all mail transfers over.
Stalwart also supports importing from Maildir and mbox formats directly through its CLI tools.
Choose Stalwart If…
- You want a web UI for managing accounts and domains
- You need JMAP support for modern email clients
- CalDAV/CardDAV in the same server appeals to you (no separate Radicale/Baikal needed)
- You want encryption at rest without bolt-on solutions
- You prefer a single, clean binary over multiple processes
- You’re starting fresh and don’t need compatibility with existing Postfix configs
Choose docker-mailserver If…
- You want the battle-tested Postfix/Dovecot stack with decades of community knowledge
- You need ClamAV for antivirus scanning
- You prefer CLI-only management and config-file-driven setup
- You need Rspamd’s advanced spam filtering capabilities and Bayesian training
- MIT license matters to you (vs Stalwart’s AGPL)
- You’re migrating from an existing Postfix/Dovecot setup and want to keep your configs
Verdict
Stalwart is the better choice for most new self-hosted email deployments. The web UI removes the biggest pain point of self-hosted email (account management), JMAP is the future of email protocols, and the resource footprint is lighter. The trade-off is a younger project with a smaller community.
If you’re an experienced sysadmin who already knows Postfix and Dovecot, docker-mailserver gives you that familiar stack in a clean Docker package. You’ll appreciate the debugging transparency and Rspamd’s mature spam filtering. But you’ll manage everything from the terminal.
Both are production-capable. Neither is a toy. The days of email being “too hard to self-host” are over — pick whichever management style you prefer.
FAQ
Can I use Stalwart with an existing Postfix setup?
No. Stalwart replaces Postfix entirely — it has its own SMTP implementation. You can migrate mail from a Postfix server to Stalwart using imapsync, but you can’t run Stalwart’s SMTP alongside Postfix.
Does docker-mailserver support JMAP?
No. docker-mailserver uses Dovecot for IMAP, and Dovecot doesn’t support JMAP. If you need JMAP, Stalwart is your option in the self-hosted space.
Which has better spam filtering?
docker-mailserver, thanks to Rspamd. Rspamd is a dedicated, mature spam filtering engine with Bayesian learning, neural networks, and extensive rule sets. Stalwart’s built-in spam filter is functional but simpler. For high-volume servers receiving significant spam, Rspamd’s capabilities are noticeably better.
Can I run ClamAV with Stalwart?
Not built-in. You could run ClamAV separately and configure Stalwart to pipe messages through it via milter, but it’s not a supported configuration out of the box. docker-mailserver has native ClamAV integration.
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments