VPSFolio

2026-11-23 · listmonk · docker · newsletter · self-hosting

Run listmonk in Docker: Self-Hosted Newsletter Manager

Deploy listmonk with Docker Compose and Postgres. Covers ports, volumes, reverse proxy, HTTPS, admin hardening, backups, and updates.

Bench run · 2026-11-23 Verified
knadh/listmonk
Total RAM
94.8 MB
Startup
55.3 s
Port
9000
HTTP
200
Per container db 50.3 MB · app 44.5 MB
listmonk/listmonk:latest · 2 containers · knadh/listmonk

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 localhost first.
  • Port 9000 is the app’s HTTP port. In production, bind it to 127.0.0.1:9000 and 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 (./uploads on 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:

  1. Change the admin password if you used the generated one.
  2. 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.
  3. Configure SMTP under Settings → SMTP and send a test email.
  4. Under Settings → Media, set the upload path to /listmonk/uploads so it matches the mounted volume.
  5. 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_USER and LISTMONK_ADMIN_PASSWORD after 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-password flag if your version supports it.
  • The root URL must match your public domain. If you install on http://localhost:9000 and later move to https://listmonk.example.com without 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.