SH SelfHostAlt
Sponsored Self-host any open-source app on Hostinger KVM VPS from $4.99/mo (1-Click Docker) →
docker-mailserver logo

docker-mailserver

MIT Docker Ready ★ 19,785 Stars Active · 2026-11-27

Production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) running inside a container. Only configuration files, no SQL database. ).

Category
Communication - Email - Complete Solutions
Tech Stack / Runtime
Docker · Shell
Open-Source License
MIT
GitHub Health
★ 19,785 · 2,133 forks
#mailserver#mail#postfix#dovecot#container
Official compose.yaml

Quick Docker Compose Reference for docker-mailserver

services:
  mailserver:
    image: ghcr.io/docker-mailserver/docker-mailserver:latest
    container_name: mailserver
    # Provide the FQDN of your mail server here (Your DNS MX record should point to this value)
    hostname: mail.example.com
    env_file: mailserver.env
    # More information about the mail-server ports:
    # https://docker-mailserver.github.io/docker-mailserver/latest/config/security/understanding-the-ports/
    ports:
      - "25:25"    # SMTP  (explicit TLS => STARTTLS, Authentication is DISABLED => use port 465/587 instead)
      - "143:143"  # IMAP4 (explicit TLS => STARTTLS)
      - "465:465"  # ESMTP (implicit TLS)
      - "587:587"  # ESMTP (explicit TLS => STARTTLS)
      - "993:993"  # IMAP4 (implicit TLS)
    volumes:
      - ./docker-data/dms/mail-data/:/var/mail/
      - ./docker-data/dms/mail-state/:/var/mail-state/
      - ./docker-data/dms/mail-logs/:/var/log/mail/
      - ./docker-data/dms/config/:/tmp/docker-mailserver/
      - /etc/localtime:/etc/localtime:ro
    restart: always
    stop_grace_period: 1m
    # Uncomment if using `ENABLE_FAIL2BAN=1`:
    # cap_add:
    #   - NET_ADMIN
    # The image does not configure a healthcheck (it is not part of the OCI image spec), `dms-healthcheck` checks all enabled services:
    healthcheck:
      test: dms-healthcheck
      start_period: 30s

docker-mailserver System Requirements & Self-Hosting Guide

Deploy docker-mailserver (4 GB+ RAM) →

Recommended VPS

4 GB+ RAM

2 – 4 vCPU · $6 – $12/mo VPS

Deployment Method

Intermediate

Docker / Docker Compose (Recommended)

Commercial Use (MIT)

Yes — free for personal, internal company, and commercial use with attribution.

Maintenance Status

Active

Last commit: 2026-11-27

Frequently Asked Questions about docker-mailserver

Is docker-mailserver free to self-host for commercial use?

docker-mailserver is released under the MIT license. Yes — free for personal, internal company, and commercial use with attribution. It has 19,785 GitHub stars and was last updated on 2026-11-27.

What VPS specifications do I need to self-host docker-mailserver?

Based on its Docker runtime and Communication - Email - Complete Solutions workload, we recommend at least 4 GB+ RAM and 2 – 4 vCPU (typically $6 – $12/mo VPS).

Does docker-mailserver support Docker deployment?

Yes — docker-mailserver supports Docker / Docker Compose (Recommended), making it intermediate to spin up on any Linux VPS.

More Open-Source Communication - Email - Complete Solutions

View all →
★ 17k Docker

Complete and fully featured mail server for use by websites & web servers. .

Replaces: Mailchimp SendGrid
MIT Docker/Ruby
Details →
★ 16.5k Docker

All-in-one mail server with JMAP, IMAP4, and SMTP support and a wide range of modern features. .

Replaces: SendGrid Google Workspace Mail
AGPL-3.0 Rust/Docker
Details →
★ 13.9k Docker

Mail server suite based on Dovecot, Postfix and other software, that provides a modern Web UI for administration. .

Replaces: SendGrid Google Workspace Mail
GPL-3.0 Docker/PHP
Details →
★ 7.6k Docker

Simple yet full-featured mail server as a set of Docker images. .

Replaces: SendGrid Google Workspace Mail
MIT Docker/Python
Details →
★ 7.2k Docker

Email alias solution to protect your email address. Comes with browser extensions and mobile apps. .

MIT Docker/Python
Details →