docker-mailserver vs Stalwart: Email Servers
Want to run your own email server without the complexity of Mailcow or Mailu? docker-mailserver and Stalwart are the two leanest options — but they take fundamentally different approaches. docker-mailserver bundles the battle-tested Postfix/Dovecot stack into a single container. Stalwart is a ground-up Rust implementation with JMAP support and a web admin interface.
Feature Comparison
| Feature | docker-mailserver | Stalwart |
|---|---|---|
| Language | C (Postfix/Dovecot) + shell scripts | Rust |
| Latest version | v15.1.0 | v0.11 |
| Docker image | mailserver/docker-mailserver:15.1.0 | stalwartlabs/mail-server:v0.11 |
| SMTP | Postfix | Built-in |
| IMAP | Dovecot | Built-in |
| JMAP | No | Yes |
| POP3 | Yes (Dovecot) | No |
| Web admin UI | No (CLI only) | Yes |
| Webmail | No | Built-in (basic) |
| Spam filtering | SpamAssassin or Rspamd | Built-in (sieve + rules) |
| Antivirus | ClamAV (optional) | No built-in |
| DKIM | OpenDKIM | Built-in |
| SPF/DMARC | Built-in | Built-in |
| Fail2ban | Built-in | Rate limiting (built-in) |
| Sieve filtering | Dovecot Sieve | ManageSieve + built-in |
| Containers needed | 1 | 1 |
| RAM (idle) | ~400-500 MB (without ClamAV) | ~100-200 MB |
| Database | Flat files | RocksDB (embedded) or SQL |
| License | MIT | AGPL-3.0 (server), Apache-2.0 (libraries) |
Architecture
docker-mailserver wraps established Linux mail components into a single container:
docker-mailserver container:
├── Postfix (SMTP)
├── Dovecot (IMAP/POP3)
├── OpenDKIM (signing)
├── SpamAssassin or Rspamd (spam)
├── ClamAV (antivirus, optional)
├── Fail2ban (brute-force protection)
└── setup.sh (CLI management)
Each component is a separate process inside the container, communicating through local sockets. This is the same architecture sysadmins have run on bare metal for decades — proven, well-documented, and debuggable with standard tools.
Stalwart is a single binary:
Stalwart binary:
├── SMTP server
├── IMAP server
├── JMAP server
├── ManageSieve server
├── Web admin UI
├── Spam filter
├── DKIM/SPF/DMARC
└── Storage engine (RocksDB or SQL)
One process handles everything. No inter-process communication overhead, no separate log streams per component. The trade-off is less visibility into individual subsystem behavior when debugging.
Installation Complexity
| Step | docker-mailserver | Stalwart |
|---|---|---|
| Docker Compose lines | ~30 | ~20 |
| SSL/TLS setup | Manual (Let’s Encrypt + cert watcher) | Built-in ACME support |
| DNS records needed | MX, SPF, DKIM, DMARC, PTR | Same |
| Account creation | setup.sh email add user@domain | Web admin UI |
| Configuration | ENV vars + mailserver.env | TOML config or web UI |
| Post-deploy time | ~30-60 minutes | ~20-40 minutes |
docker-mailserver requires more manual configuration. You run setup.sh commands to add email accounts, generate DKIM keys, and configure aliases. There’s no UI — everything happens through the CLI and configuration files.
Stalwart provides a web admin interface at port 443 where you create accounts, manage domains, and view logs. ACME (Let’s Encrypt) certificate provisioning is built-in, eliminating the need for a separate certificate management workflow.
Performance and Resources
Stalwart is significantly lighter. Its single Rust binary uses a fraction of the resources that docker-mailserver’s multi-process stack requires.
| Metric | docker-mailserver | Stalwart |
|---|---|---|
| RAM (idle, no ClamAV) | ~400-500 MB | ~100-200 MB |
| RAM (with ClamAV) | ~1-1.5 GB | N/A (no antivirus) |
| CPU (idle) | Low | Very low |
| Startup time | ~15-30s | ~2-5s |
| Disk (application) | ~500 MB | ~50-80 MB |
If you’re running on constrained hardware — a VPS with 1-2 GB RAM — Stalwart leaves more room for other services. docker-mailserver with ClamAV enabled can consume 1.5 GB on its own.
Maturity and Track Record
| Metric | docker-mailserver | Stalwart |
|---|---|---|
| First release | 2016 | 2022 |
| Underlying tech age | Postfix: 1998, Dovecot: 2002 | 2022 |
| GitHub stars | ~15,000+ | ~7,000+ |
| Production deployments | Very many | Growing |
| Known RFC compliance | Excellent (Postfix/Dovecot) | Good (improving) |
| Email deliverability record | Proven | Less established |
docker-mailserver stands on components with 20+ years of production history. When email deliverability issues arise, the debugging path is well-documented — Postfix and Dovecot have extensive community knowledge, Stack Overflow answers, and sysadmin guides.
Stalwart is newer. It’s well-engineered and passes RFC compliance tests, but it hasn’t been through the same volume of edge cases. If you hit a deliverability issue, you’ll have a smaller community to draw from.
Use Cases
Choose docker-mailserver If…
- You want battle-tested components (Postfix/Dovecot) with decades of production history
- You need ClamAV antivirus scanning on incoming mail
- You’re comfortable with CLI management and don’t need a web UI
- Debugging via standard Linux mail tools (postqueue, doveadm, mail.log) matters to you
- You run a multi-domain setup with complex routing rules
Choose Stalwart If…
- You want a modern, lightweight mail server with minimal resource usage
- You prefer a web admin UI over CLI management
- You need JMAP support (for modern email clients like Mimestream)
- You want built-in ACME/Let’s Encrypt without extra tooling
- You’re running on constrained hardware (1-2 GB RAM)
- You want a single-binary deployment with no inter-process complexity
Final Verdict
If you value proven reliability and don’t mind CLI management, docker-mailserver is the safer choice. Postfix and Dovecot handle edge cases that newer implementations haven’t encountered yet. Email deliverability depends on reputation and RFC compliance — decades of production use give docker-mailserver’s underlying components an edge.
If you want a modern, lightweight alternative with a web UI and JMAP support, Stalwart is impressive for its age. It’s the better choice for small deployments where resource efficiency matters and you prefer browser-based administration. Just be aware that you’re running a younger codebase for a protocol where maturity matters.
For full-featured email with a web UI, antivirus, and webmail, consider Mailcow or Mailu instead.
Frequently Asked Questions
Can I migrate from docker-mailserver to Stalwart?
Yes, but it requires exporting mailboxes (via IMAP sync tools like imapsync or offlineimap) and recreating accounts. DNS records (MX, SPF, DMARC) stay the same if you keep the same domain.
Which has better spam filtering?
docker-mailserver with Rspamd is more mature. Rspamd uses Bayesian filtering, fuzzy hashing, neural networks, and community-maintained rules. Stalwart’s built-in spam filter is functional but less sophisticated — it relies primarily on Sieve rules and DNS-based blocklists.
Do I still need to worry about email deliverability with either?
Yes. Self-hosted email deliverability depends on PTR records, IP reputation, SPF/DKIM/DMARC configuration, and warm-up — regardless of which server software you use. Both tools support the necessary authentication mechanisms.
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