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

Featuredocker-mailserverStalwart
LanguageC (Postfix/Dovecot) + shell scriptsRust
Latest versionv15.1.0v0.11
Docker imagemailserver/docker-mailserver:15.1.0stalwartlabs/mail-server:v0.11
SMTPPostfixBuilt-in
IMAPDovecotBuilt-in
JMAPNoYes
POP3Yes (Dovecot)No
Web admin UINo (CLI only)Yes
WebmailNoBuilt-in (basic)
Spam filteringSpamAssassin or RspamdBuilt-in (sieve + rules)
AntivirusClamAV (optional)No built-in
DKIMOpenDKIMBuilt-in
SPF/DMARCBuilt-inBuilt-in
Fail2banBuilt-inRate limiting (built-in)
Sieve filteringDovecot SieveManageSieve + built-in
Containers needed11
RAM (idle)~400-500 MB (without ClamAV)~100-200 MB
DatabaseFlat filesRocksDB (embedded) or SQL
LicenseMITAGPL-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

Stepdocker-mailserverStalwart
Docker Compose lines~30~20
SSL/TLS setupManual (Let’s Encrypt + cert watcher)Built-in ACME support
DNS records neededMX, SPF, DKIM, DMARC, PTRSame
Account creationsetup.sh email add user@domainWeb admin UI
ConfigurationENV vars + mailserver.envTOML 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.

Metricdocker-mailserverStalwart
RAM (idle, no ClamAV)~400-500 MB~100-200 MB
RAM (with ClamAV)~1-1.5 GBN/A (no antivirus)
CPU (idle)LowVery 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

Metricdocker-mailserverStalwart
First release20162022
Underlying tech agePostfix: 1998, Dovecot: 20022022
GitHub stars~15,000+~7,000+
Production deploymentsVery manyGrowing
Known RFC complianceExcellent (Postfix/Dovecot)Good (improving)
Email deliverability recordProvenLess 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.

Comments