This guide provides a step-by-step walkthrough of installing and configuring mailcow-dockerized, a popular open-source email server solution, using Docker.
Prerequisites:
Your server should meet the following minimum requirements:
CPU: 1 GHz or faster
RAM: 6 GiB (plus 1 GiB swap, as per default configuration)
Disk Space: 20 GiB minimum (excluding email storage)
Architecture: x86_64 or ARM64
A domain name and the ability to manage its DNS records.
Step 1: DNS Configuration
Before installing mailcow-dockerized, configure the necessary DNS records for your domain. Crucially, you’ll need to create A or AAAA records pointing your domain (and any subdomains you plan to use for mail) to your server’s public IP address.
- Step 2: Installation
- Connect to your server via SSH.
- Navigate to the /opt directory:cd /opt
- Clone the mailcow-dockerized repository:git clone https://github.com/mailcow/mailcow-dockerized
- Enter the mailcow-dockerized directory:cd /opt/mailcow-dockerized
Run the configuration script:./generate_config.sh
This script will guide you through the initial configuration, including setting your domain name and timezone. Pay close attention to the prompts.
Pull Docker images:docker compose pull
Start the Docker containers:docker compose up -d
The -d flag runs the containers in detached mode (in the background).
Step 3: Accessing the mailcow UI
After the containers are running (this may take a few minutes), you can access the mailcow web interface by navigating to your domain in a web browser.
Step 4: Domain Setup in mailcow
Log in to the mailcow UI.
Navigate to the “Email” section and then “Configuration”.
In the “Domains” tab, click “Add Domain”.
Follow the instructions to add your domain. mailcow will provide DNS records that you must configure at your DNS provider for email to function correctly. This is a critical step.
Step 5: Creating Email Accounts
Navigate to the “Users” tab.
Click “Add User” to create new email accounts.
Users can access their mailboxes via the SOGo webmail interface, accessible under “Apps” -> “Webmail”.
Step 6: Firewall Configuration
Ensure your server’s firewall allows traffic on the following ports. These are essential for email communication:
SMTP: 25 (outbound), 465 (SMTPS), 587 (Submission)
IMAP: 143, 993 (IMAPS)
POP3: 110, 995 (POP3S)
Sieve: 4190
HTTP/HTTPS: 80, 443
If you encounter any issues while configuring your emails, feel free to contact us, and we will be happy to assist you.

