
Mailcow is a dockerized open-source mail server that packages everything needed for a complete email stack on Linux. It bundles a mail transfer agent, spam filtering, webmail, and security tools behind one web interface. Want complete control over your email without wrestling with a dozen moving parts? Mailcow handles that. Here’s what the installation process looks like.
Why Run Mailcow as Your Email Server on Linux
Your own SMTP server means nobody else controls your email infrastructure, and mailcow makes the setup reasonable. The open-source codebase gets regular security patches, you’re not trapped in a vendor’s ecosystem, and because the platform is built on Docker, it works the same way across Debian, Ubuntu, and most other distributions. No dependency hell, no conflicting system packages. The web interface takes care of domain management, mailbox creation, spam tuning, and TLS settings without forcing you into config files. A solid SMTP server backend paired with an interface that doesn’t require constant terminal access is what makes mailcow work for solo developers and small teams alike.
What the Mailcow Dockerized Mail Server Suite Actually Does
Mailcow isn’t one application. It’s a dockerized mail server suite that combines Postfix for mail transfer, Dovecot for IMAP and POP3, SOGo for webmail and groupware, Rspamd for spam and virus filtering, and Nginx as the reverse proxy. Docker Compose ties them together. The interface lets you manage the whole thing from a browser. For automation, the platform has a REST API. Plugins and hooks let you customize deeper when needed. The documentation covers enough ground that non-standard setups are manageable. Out of the box, it works. When requirements change, it bends.
Why Mailcow Features Matter for Self-Hosting
Hosted alternatives and commercial platforms charge per seat. Self-hosting is free. Since mailcow is a dockerized open-source mail server, upgrades are predictable, rollbacks work, and your config lives in files you can version control. The community catches bugs fast. The forum and GitHub issues are actually useful when something breaks. The interface beats editing Postfix tables and Dovecot configs by hand. That cuts the time cost of running your own mail infrastructure.
Mailcow System Requirements: RAM, CPU, and What Else You Need
Check your hardware before starting the install. Skipping this step is why most installations hit performance problems right after launch.
Hardware Specs
Minimum system requirements start at 6 GB of RAM. For real traffic, 8 GB is the floor. CPU needs are light—2 cores handle low-to-medium volume—but RAM matters more because multiple containers run at once. A Contabo VPS or dedicated box with 2 vCPUs and 6 to 8 GB of RAM covers the RAM and CPU needs comfortably. Plan disk space around mailbox usage: 20 GB minimum for system and containers, plus whatever mail storage you expect.
Software Stack
The platform runs on Debian and Ubuntu LTS. Mailcow on Debian 11 or Debian 12 is the standard setup. Mailcow on Ubuntu 22.04 LTS works just as well. You need Docker and Docker Compose, both installed in the steps below. The server needs a fully qualified domain name (FQDN), and ports 25, 80, 110, 143, 443, 465, 587, 993, and 995 must be open to the internet.
Mailcow Dockerized Installation Guide
This is a full installation on Debian 11 with DNS configuration. Following the steps in order avoids the usual installation failures and gets you a working mail server.
System Prep
Update packages first:
sudo apt update && sudo apt upgrade -y
Install what the stack needs before Docker goes in:
sudo apt install curl git wget -y
Docker and Docker Compose Setup
Get Docker from the official script. Don’t use the Debian or Ubuntu repo versions—they’re usually outdated:
curl -fsSL https://get.docker.com | sh
sudo systemctl enable docker
sudo systemctl start docker
Mailcow uses Docker Compose for its container stack. Install the plugin:
sudo apt install docker-compose-plugin -y
Check it:
docker compose version
DNS Records Before Installation
Set up DNS records before you install. At minimum:
- An A record pointing your mail hostname (mail.example.com) to the server’s public IP
- An MX record pointing your domain (example.com) to the mail hostname
- PTR records through your hosting provider matching the A record
- SPF, DKIM, and DMARC records (DKIM gets configured after the platform generates the key)
The full DNS setup with all record formats and autodiscovery options is at mailcow.github.io/mailcow-dockerized-docs.
Installing Mailcow
Clone the repository:
cd /opt
sudo git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
Generate the mailcow.conf file:
sudo ./generate_config.sh
Enter your mail hostname when asked (mail.example.com). The script detects timezone—confirm it’s right.
Pull images and start the stack:
sudo docker compose pull
sudo docker compose up -d
This downloads everything and starts the suite. Depending on connection speed, it takes a few minutes.
Check the Mailcow UI Login
See if containers are up:
sudo docker compose ps
All should show “Up”. If anything’s restarting or exited, check logs:
sudo docker compose logs <container_name>
Once healthy, open https://mail.example.com in a browser.
Initial Setup: Default Login, DKIM, DMARC
After installation, configure these before using the server.
Open the UI at https://mail.example.com. The default login is:
- Username: admin
- Password: moohoo
These are the default credentials shipped with every install. The default admin password is public knowledge. Change it now.
Go to Configuration > Mail setup and update the admin password.
For DKIM setup, go to Configuration > ARC/DKIM keys. Generate a key for your domain. Add the DKIM TXT record to DNS at your registrar.
For DMARC, add a TXT record to the _dmarc subdomain:
v=DMARC1; p=none; rua=mailto:[email protected]Create test mailboxes under Configuration > Mail setup > Mailboxes. Send test messages between them or to an external address before calling it done.
Mailcow Setup: Domains and Mailboxes
Once the installation works, the next part of configuration is adding domains and mailboxes.
Adding Domains
Log into the UI at https://mail.example.com.
Go to Configuration > Mail setup > Domains.
Click “Add domain”. Enter your domain (example.com). Set quota limits, backup MX options, and active status as needed. Backup MX lets you designate a secondary mail server for downtime.
Click “Add domain” to save.
The platform checks that DNS points to your server and records are in place.
Creating Mailboxes
Under Mail setup, go to Mailboxes.
Click “Add mailbox”:
- Local Part: The part before @ (user for [email protected])
- Domain: Pick the domain you added
- Password: Set something strong
- Full Name: Display name
- Quota: Storage limit based on expected usage
Click “Add mailbox”.
Repeat for each user.
Users access mailboxes through the webmail interface at https://mail.example.com or by configuring a client with the SMTP settings shown in the UI. For Contabo webmail or a Contabo email server, the HTTPS URL is the same access point.
Send and receive test emails from each mailbox before handing out access.
Wrapping Up the Mailcow Mail Server Setup
This tutorial walked through the full process on Debian 11: prepping the environment, installing Docker and Docker Compose, configuring DNS records for SPF, DKIM, and DMARC, cloning and starting the dockerized stack, handling initial configuration, and setting up domains and mailboxes through the interface. A Contabo mail server gives you the hardware mailcow needs to run its full container stack without hitting resource limits.
Keeping Mailcow Healthy
A few habits keep the installation running smoothly.
Run regular updates. Pull the latest images and restart:
cd /opt/mailcow-dockerized
sudo git pull
sudo docker compose pull
sudo docker compose up -d
The platform pushes updates often. Staying current is the best defense against new vulnerabilities.
Set up an SMTP relay if your host blocks port 25 (common on VPS platforms). A transactional relay service handles outbound delivery and sidesteps port blocks and IP reputation problems.
Back up mail data and config files regularly. The stack stores data in Docker volumes. Your backup needs those volumes plus the mailcow.conf file. Schedule automated backups to off-server storage so hardware failure doesn’t mean data loss. Include the docker-compose config if you’ve customized the stack.
Watch the spam filter. Check Rspamd’s dashboard occasionally to tune rules and catch odd sending patterns early.
TLS certificates renew automatically through Let’s Encrypt, but verify auto-renewal works after initial setup.
Common Questions About Mailcow
You need an A record for the mail hostname, an MX record pointing to it, an SPF TXT record for the sending domain, a DKIM TXT record generated under ARC/DKIM keys, and a DMARC TXT record on the _dmarc subdomain. Full formats are in the documentation. The platform handles DKIM through the UI—it generates the key and shows you the exact DNS record. SPF and DMARC go in manually at your DNS provider. Getting all three right builds sender reputation and keeps messages out of spam folders.
No. The platform is Docker-specific. The whole thing runs on containerized services managed through Docker Compose. Updates, backups, tooling—all of it assumes Docker. If you want a mail server without Docker, you’d need a different project or manual configuration of Postfix, Dovecot, Rspamd, and the rest, which is a lot more work.
Yes. Add domains through the UI under Configuration > Mail setup > Domains. Each domain needs its own DNS records: MX, SPF, DKIM, DMARC. Backup MX is per-domain. There’s no hard cap on domain count—it depends on server resources. One decent server can handle email for multiple domains without extra infrastructure.
A docker update pulls the latest from the GitHub repo and updates container images:sudo git pull
sudo docker compose pull
sudo docker compose up -d
The repo includes an update.sh script in the root that handles the process with pre-update checks. Use that script on production servers—it catches edge cases a manual pull might miss.
The stack keeps data in named Docker volumes. A full backup exports those volumes plus mailcow.conf and docker-compose.yml. The documentation has a helper script that exports mail data, databases, and Redis state. Restoration imports volumes to a fresh install using the same script. Schedule backups to off-server storage (object storage bucket or remote server) so hardware failure doesn’t kill your data. Include the docker-compose file if you’ve customized the stack.