This tutorial was written with AI assistance from the project's official documentation. Verification status is stated at the end of the article.
What listmonk does and what it needs
listmonk is a self-hosted newsletter and mailing list manager. It ships as a single Go binary with a Vue admin UI, backed by PostgreSQL. You get subscriber management, campaign scheduling, templates, bounce processing, and analytics without handing your list to a SaaS provider.
The official Docker setup runs two containers: the listmonk/listmonk app and postgres:17-alpine. The app listens on port 9000 and talks to Postgres over a private Docker network. Uploads (media, attachments) live on disk, so you need a persistent volume or bind mount for /listmonk/uploads. The database needs its own named volume.
The upstream project does not publish a minimum RAM figure. Idle memory is modest, but campaign sending, large imports, and bounce processing scale with subscriber count and concurrency. Size the VPS around your list size and sending cadence, not a fixed number.
Prerequisites, ports, and volume constraints
- A Linux VPS with Docker Engine 24+ and the Compose plugin.
- A domain name pointed at the server if you want HTTPS. You can test on
localhostfirst. - Port 9000 is the app's HTTP port. In production, bind it to
127.0.0.1:9000and let a reverse proxy terminate TLS on 443. - Postgres should not be exposed publicly. The official compose binds it to
127.0.0.1:5432; keep that or remove the port mapping entirely. - Two persistent locations: the Postgres data volume (
listmonk-data) and the uploads directory (./uploadson the host, mounted at/listmonk/uploads). - SMTP credentials from your mail provider (SES, Postmark, Mailgun, etc.). listmonk needs them to actually deliver campaigns.
Production Docker Compose setup
Create a project directory and write the compose file. This version uses environment variables for secrets, binds the app to localhost, and keeps the official install/upgrade command.
mkdir -p ~/listmonk && cd ~/listmonk cat <<'EOF' > compose.yml services: app: image: listmonk/listmonk:latest container_name: listmonk_app restart: unless-stopped ports: - "127.0.0.1:9000:9000" networks: - listmonk hostname: ${LISTMONK_HOSTNAME:-listmonk.example.com} depends_on: db: condition: service_healthy command: [sh, -c, "./listmonk --install --idempotent --yes --config '' && ./listmonk --upgrade --yes --config '' && ./listmonk --config ''"] environment: LISTMONK_app__address: 0.0.0.0:9000 LISTMONK_db__user: ${DB_USER:-listmonk} LISTMONK_db__password: ${DB_PASSWORD} LISTMONK_db__database: ${DB_NAME:-listmonk} LISTMONK_db__host: db LISTMONK_db__port: 5432 LISTMONK_db__ssl_mode: disable LISTMONK_db__max_open: 25 LISTMONK_db__max_idle: 25 LISTMONK_db__max_lifetime: 300s TZ: ${TZ:-Etc/UTC} LISTMONK_ADMIN_USER: ${LISTMONK_ADMIN_USER:-} LISTMONK_ADMIN_PASSWORD: ${LISTMONK_ADMIN_PASSWORD:-} volumes: - ./uploads:/listmonk/uploads:rw db: image: postgres:17-alpine container_name: listmonk_db restart: unless-stopped networks: - listmonk environment: POSTGRES_USER: ${DB_USER:-listmonk} POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: ${DB_NAME:-listmonk} healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-listmonk}"] interval: 10s timeout: 5s retries: 6 volumes: - listmonk-data:/var/lib/postgresql/data networks: listmonk: volumes: listmonk-data: EOF Generate secrets and write .env. The admin user and password are only used on the very first start; after that, listmonk ignores them.
cat <<EOF > .env DB_USER=listmonk DB_PASSWORD=$(openssl rand -hex 32) DB_NAME=listmonk TZ=Etc/UTC LISTMONK_HOSTNAME=listmonk.example.com LISTMONK_ADMIN_USER=admin LISTMONK_ADMIN_PASSWORD=$(openssl rand -hex 16) EOF chmod 600 .env Create the uploads directory and start the stack.
mkdir -p uploads docker compose up -d docker compose logs -f app Wait for the log line that says the server is listening on 0.0.0.0:9000. Then open http://127.0.0.1:9000 from the server (or via SSH tunnel) and log in with the admin credentials from .env.
Reverse proxy, HTTPS, and first-run hardening
listmonk serves plain HTTP on 9000. Put Caddy or Nginx in front to terminate TLS. Because the app is bound to 127.0.0.1, it is not reachable from the public internet until the proxy is configured.
Caddy example (/etc/caddy/Caddyfile):
listmonk.example.com { encode gzip reverse_proxy 127.0.0.1:9000 } Nginx example:
server { listen 443 ssl http2; server_name listmonk.example.com; ssl_certificate /etc/letsencrypt/live/listmonk.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/listmonk.example.com/privkey.pem; client_max_body_size 50m; location / { proxy_pass http://127.0.0.1:9000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } listmonk does not use WebSockets for the admin UI, but it does serve large CSV imports and media uploads. Set client_max_body_size high enough for your subscriber lists. If you use Nginx, also raise proxy_read_timeout for long-running imports.
After the proxy is live, log in and immediately:
- Change the admin password if you used the generated one.
- Go to Settings → General and set the Root URL to
https://listmonk.example.com. This is used in tracking pixels, unsubscribe links, and public subscription pages. Getting it wrong breaks links in every campaign. - Configure SMTP under Settings → SMTP and send a test email.
- Under Settings → Media, set the upload path to
/listmonk/uploadsso it matches the mounted volume. - Create a non-admin user for day-to-day work if multiple people need access.
If you are testing without a domain, use an SSH tunnel instead of exposing port 9000:
ssh -L 9000:127.0.0.1:9000 user@your-server Then visit http://localhost:9000 on your laptop.
Updating, backups, and common pitfalls
Update the app and database images:
docker compose pull docker compose up -d docker compose logs -f app The command in the compose file runs --upgrade --yes on every start, so database migrations apply automatically. Still, take a backup before pulling a new image.
Back up the database and uploads:
docker compose exec -T db pg_dump -U listmonk listmonk | gzip > listmonk-$(date +%F).sql.gz tar czf listmonk-uploads-$(date +%F).tar.gz uploads/ Restore the database:
gunzip -c listmonk-2025-01-01.sql.gz | docker compose exec -T db psql -U listmonk -d listmonk Two pitfalls worth knowing:
- The admin env vars only apply on first install. If you set
LISTMONK_ADMIN_USERandLISTMONK_ADMIN_PASSWORDafter the database already has users, nothing happens. To reset, use the CLI inside the container:docker compose exec app ./listmonk --config ''does not reset passwords; use the admin UI or the--reset-passwordflag if your version supports it. - The root URL must match your public domain. If you install on
http://localhost:9000and later move tohttps://listmonk.example.comwithout updating Settings → General → Root URL, unsubscribe links and tracking pixels in sent campaigns will point to the wrong host. Fix it before your first real send.
Also keep the Postgres volume (listmonk-data) on a disk with room to grow. Campaign history and subscriber events accumulate; a few hundred thousand subscribers can push the database into the gigabytes.
Measured in our sandbox run: total memory 94.8 MB (sum of per-container peaks over a 30s idle window after startup) across 2 containers; largest container 50.3 MB; published port(s) 9000; HTTP probe returned 200. The run took 55.3s including the image download. Required secret(s) DB_PASSWORD were generated for the test run, as the tutorial instructs. Container breakdown: db 50.3 MB, app 44.5 MB.
Verification: we ran this docker-compose stack in a disposable Docker environment and recorded the measurements above. They describe that run, not a guarantee for your host.
Originally published with full interactive benchmark metrics and server sizing notes at https://vpsfolio.pages.dev/listmonk-docker-self-hosting/.

