This guide describes how to install docker-mailserver using Docker Compose.
If you are setting up docker-mailserver for the first time, the Getting Started tutorial provides a step-by-step walkthrough that covers these same steps with more explanation.
- Docker and Docker Compose installed on the host
- A domain name
- Root or sudo access on the host
Copy the example environment file and edit .env:
cp .env.dist .envSet at least MYSQL_PASSWORD, REDIS_PASSWORD, CONTROLLER_PASSWORD, and DOVEADM_API_KEY. See Environment variables reference.
bin/production.sh pullbin/production.sh up -d --waitbin/production.sh run --rm web setup.shFollow the wizard to create your first account and admin user.
- Management:
http://127.0.0.1:81/manager/ - Webmail:
http://127.0.0.1:81/webmail/
- Configure DNS (MX, SPF, DKIM, DMARC). See How to configure DNS and DNS records reference.
- Replace self-signed TLS with valid certificates. See How to configure TLS certificates.
- Configure firewall, backups, and monitoring as needed.
- Services not starting: Check logs with
docker-compose logsorbin/production.sh logs. - Database errors: Verify
MYSQL_*and database accessibility. - TLS issues: Check certificate paths and permissions.
- Port conflicts: Ensure ports 25, 110, 143, 587, 993, 995, 81 are free.
For port details, see Ports reference.