listmonk with Docker Compose
High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app. In the project's words: listmonk on GitHub (repository description) checked 2026-10-03
Runs on: amd64, arm64, arm/v7, arm/v6 from each image's registry manifest, checked 2026-10-03; a CPU counts only if every image has a build for it. Image by image
Add listmonk to the builder to use your own domain, get its passwords generated in your browser, and combine it with other apps in one file.
What listmonk needs
Only figures listmonk's own documentation publishes, each linked to the page it is on. Where the project gives no number, this page does not invent one.
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | The project publishes no figure | |
| CPU | The project publishes no figure | |
| Disk | The project publishes no figure | |
Which hardware listmonk has images for
Read from each image's manifest list in its registry (anonymous, read-only) when this page was built. An app counts for a CPU only if every one of its images lists it.
- x86-64 PC or NAS (
linux/amd64): every image has a build. - Raspberry Pi 4/5, 64-bit OS (
linux/arm64): every image has a build. - Raspberry Pi 3 or Zero 2 W, 32-bit OS (
linux/arm/v7): every image has a build.
| Service | Image | Platforms in the manifest | Digest | Registry | Checked |
|---|---|---|---|---|---|
app | listmonk/listmonk:latest | amd64, arm64, arm/v6, arm/v7 | sha256:f535d59e14991337a9f2d570273685378ae86b0d7698c3e00da444e3bc205286 | registry-1.docker.io | 2026-10-03 |
db | postgres:17-alpine | amd64, arm/v6, arm/v7, arm64, 386, ppc64le, riscv64, s390x | sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24 | registry-1.docker.io | 2026-10-03 |
docker-compose.yml
This is exactly what the builder writes for listmonk alone on example.org: the official definition with its published ports removed and Caddy added in front. The time zone is Etc/UTC here; the builder uses your browser's. Every ${VARIABLE} is defined in the .env below.
# docker-compose.yml built at dankhost.com for: listmonk # Each app block is its official compose definition. Only the names were prefixed with # the app slug (services, containers, volumes, bind folders, .env variables) so any set of # apps can share one file; other differences are listed under "Changed:" in each block. # Only Caddy publishes ports. Secrets live in .env next to this file. services: # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ---- # Source: https://caddyserver.com/docs/running (checked 2026-09-23) # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23) # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly. caddy: image: "caddy:2" container_name: "caddy" restart: "unless-stopped" ports: - "80:80" - "443:443" - "443:443/udp" volumes: - "./caddy:/etc/caddy" - "caddy-data:/data" - "caddy-config:/config" networks: proxy: ipv4_address: "172.30.0.2" # ---- listmonk (lists.example.org) ---- # Source: https://github.com/knadh/listmonk/blob/master/docker-compose.yml (checked 2026-10-03) # Source: https://github.com/knadh/listmonk/blob/master/docs/docs/content/installation.md (checked 2026-10-03) # Source: https://github.com/knadh/listmonk/blob/master/docs/docs/content/upgrade.md (checked 2026-10-03) # Source: https://github.com/knadh/listmonk/blob/master/docs/docs/content/configuration.md (checked 2026-10-03) # Changed: Removed the documented '9000:9000' port and the database's '127.0.0.1:5432:5432'; Caddy reaches listmonk-app:9000 on the proxy network and the database publishes nothing. container_name and the example hostname listmonk.example.com are dropped. # The file's x-db-credentials anchor is written out: user and database listmonk, and the password, 'listmonk' in the file, is a generated value in .env used by both services. TZ is your browser's time zone instead of Etc/UTC. # LISTMONK_ADMIN_USER and LISTMONK_ADMIN_PASSWORD, empty in the file, are admin and a generated password, so the Super Admin exists from the first start (the installation page: set them "only the first time"). # The database volume is written in short form (listmonk-data:/var/lib/postgresql/data) instead of the file's long type: volume form, and the documented listmonk network is the app's own internal back-end network. listmonk-app: image: "listmonk/listmonk:latest" container_name: "listmonk-app" restart: "unless-stopped" depends_on: - "listmonk-db" 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: "listmonk" LISTMONK_db__password: "${LISTMONK_DB_PASSWORD}" LISTMONK_db__database: "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: "Etc/UTC" LISTMONK_ADMIN_USER: "admin" LISTMONK_ADMIN_PASSWORD: "${LISTMONK_ADMIN_PASSWORD}" volumes: - "./listmonk/uploads:/listmonk/uploads:rw" networks: proxy: {} listmonk-backend: aliases: - "app" listmonk-db: image: "postgres:17-alpine" container_name: "listmonk-db" restart: "unless-stopped" environment: POSTGRES_USER: "listmonk" POSTGRES_PASSWORD: "${LISTMONK_DB_PASSWORD}" POSTGRES_DB: "listmonk" healthcheck: test: - "CMD-SHELL" - "pg_isready -U listmonk" interval: "10s" timeout: "5s" retries: 6 volumes: - "listmonk-data:/var/lib/postgresql/data" networks: listmonk-backend: aliases: - "db" networks: # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact. # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's # ipv4_address and in every trusted-proxy value to a free 172.x.0 range. proxy: ipam: config: - subnet: "172.30.0.0/24" ip_range: "172.30.0.128/25" gateway: "172.30.0.1" listmonk-backend: internal: true volumes: caddy-data: caddy-config: listmonk-data:
Caddyfile save as caddy/Caddyfile
Caddy gets and renews the HTTPS certificate for lists.example.org by itself once the DNS record points at your server and ports 80 and 443 reach it.
# Caddyfile built at dankhost.com. Save it as ./caddy/Caddyfile next to docker-compose.yml.
# Caddy gets and renews a Let's Encrypt certificate for each name below by itself,
# once the DNS records point at this server and ports 80 and 443 reach it.
# listmonk
lists.example.org {
reverse_proxy listmonk-app:9000
}
.env
The secrets are left blank here on purpose: a password printed on a public page is the same for everyone who copies it. The builder fills them with random letters and digits made in your browser.
# .env for listmonk, from dankhost.com/app/listmonk/. Fill the blank secrets before starting. # Keep this file private (chmod 600). # listmonk # 32 random letters and digits: the builder fills this in your browser LISTMONK_DB_PASSWORD= # 24 random letters and digits: the builder fills this in your browser LISTMONK_ADMIN_PASSWORD=
Changes from the official file
Besides prefixing every service, container, volume, folder and variable with listmonk (so any set of apps can share one file), these are all the differences from what the project documents:
- Removed the documented '9000:9000' port and the database's '127.0.0.1:5432:5432'; Caddy reaches listmonk-app:9000 on the proxy network and the database publishes nothing. container_name and the example hostname listmonk.example.com are dropped.
- The file's x-db-credentials anchor is written out: user and database listmonk, and the password, 'listmonk' in the file, is a generated value in .env used by both services. TZ is your browser's time zone instead of Etc/UTC.
- LISTMONK_ADMIN_USER and LISTMONK_ADMIN_PASSWORD, empty in the file, are admin and a generated password, so the Super Admin exists from the first start (the installation page: set them "only the first time").
- The database volume is written in short form (listmonk-data:/var/lib/postgresql/data) instead of the file's long type: volume form, and the documented listmonk network is the app's own internal back-end network.
Notes for listmonk behind the proxy
- Log in at https://lists.example.org/admin as admin with LISTMONK_ADMIN_PASSWORD from .env. Then, in Settings > General, set Root URL to https://lists.example.org: subscription, unsubscribe and tracking links in every e-mail are built from it.
- listmonk sends nothing until you add an SMTP server (Settings > SMTP). The container itself needs outbound access to it, which the proxy network gives.
- Uploads go to ./listmonk/uploads only after you set the media path to /listmonk/uploads under Settings > Media, as the file's comment says.
- The app runs --install --idempotent and --upgrade on every start, so a new image migrates the database by itself.
How to run it
- At your DNS provider, add an A record named
listson your domain pointing at the server's public IP address, and forward TCP 80, TCP 443 and UDP 443 to it. - Save the three files in one folder:
docker-compose.ymland.envside by side, the Caddyfile at./caddy/Caddyfile. Replaceexample.orgwith your domain in the Caddyfile, the compose file and the .env, or let the builder do it. - Fill the blank
LISTMONK_DB_PASSWORD,LISTMONK_ADMIN_PASSWORDin.env. The builder generates them; on the server,tr -dc A-Za-z0-9 </dev/urandom | head -c 32prints 32 random letters and digits. Thenchmod 600 .env. - Start it:
docker compose up -d docker compose logs -f caddy # watch the certificate arrive
- Open the new address (
lists.plus your domain) in a browser and follow the notes above.
Back it up
listmonk's upgrade page says to "always take a backup of the Postgres database before upgrading" but publishes no procedure. Everything but the uploaded media is in that database: a pg_dump plus a copy of ./uploads is the whole backup.
Below is the BACKUP.md the builder writes next to the compose file above: which of its folders and volumes hold data, the dump command the project documents, rewritten for this file's service names, what to copy with which container stopped, and a restore check. Pick more apps in the builder and it covers them all in one file.
# BACKUP.md built at dankhost.com for: listmonk
What to copy from the docker-compose.yml built with this file, the database dump each project documents (rewritten for the service names in that file), what to copy with which container stopped, and how to check the result. Run every command in the folder that holds docker-compose.yml.
The folders are owned by the containers' users: put sudo in front of tar if it says "Permission denied". Named volumes live under /var/lib/docker/volumes, not next to the compose file, so they are copied through a throwaway ubuntu container (Docker's documented --volumes-from method). tar makes a full copy each run; for large folders an incremental tool (restic, borg, rsync) saves time and space.
Never run "docker compose down -v" on this file: it deletes the named volumes of every app in it.
## Before you start
BACKUP=/mnt/backup/selfhost # change this: a disk or machine other than this server's system disk
mkdir -p "$BACKUP"
## Every time: the three stack files
tar czf "$BACKUP/stack-files.tar.gz" docker-compose.yml .env caddy
.env holds the database passwords and secret keys the apps were set up with; keep this archive as private as the data.
## Caddy (the reverse proxy)
Caddy's docs: 'The data directory must not be treated as a cache.' It holds the TLS certificates and their private keys; without it Caddy has to ask Let's Encrypt for every certificate again.
- caddy-data (named volume, /data in caddy)
BACK UP: TLS certificates, private keys, OCSP staples.
- caddy-config (named volume, /config in caddy)
SKIP: the last active configuration, kept for 'caddy run --resume', which this setup does not use: it starts from the Caddyfile.
- ./caddy (/etc/caddy in caddy)
IN stack-files.tar.gz: the Caddyfile, copied with the stack files above.
Copy (Caddy keeps serving while you copy):
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu tar cvf /backup/caddy-data.tar /data
Restore check:
tar tf "$BACKUP/caddy-data.tar" > /dev/null && echo OK
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu bash -c "cd /data && tar xvf /backup/caddy-data.tar --strip 1"
Sources:
- Caddy docs: Conventions, Data directory: https://caddyserver.com/docs/conventions#data-directory (checked 2026-09-24)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-24)
## listmonk
listmonk's upgrade page says to "always take a backup of the Postgres database before upgrading" but publishes no procedure. Everything but the uploaded media is in that database: a pg_dump plus a copy of ./uploads is the whole backup.
What this compose mounts:
- ./listmonk/uploads (/listmonk/uploads in listmonk-app)
BACK UP: images and files uploaded for campaigns (once the media path is set to /listmonk/uploads).
- listmonk-data (named volume, /var/lib/postgresql/data in listmonk-db)
COVERED BY THE COMMAND BELOW: PostgreSQL's data files: lists, subscribers, campaigns, templates and settings. The pg_dump below is the copy to keep.
1. Database dump for listmonk-db:
docker compose exec -T listmonk-db pg_dump -U listmonk listmonk > "$BACKUP/listmonk.sql"
pg_dump with the user and database of the file, both listmonk.
2. Copy (listmonk keeps running):
pg_dump is consistent while the app runs: the dump is a snapshot of the database at the moment it started (PostgreSQL docs).
tar czf "$BACKUP/listmonk-uploads.tar.gz" ./listmonk/uploads
Restore check:
grep -c 'PostgreSQL database dump complete' "$BACKUP/listmonk.sql" # 1 means pg_dump finished
tar tzf "$BACKUP/listmonk-uploads.tar.gz" > /dev/null && echo OK
Put a copy back (with listmonk stopped):
tar xzf "$BACKUP/listmonk-uploads.tar.gz" # recreates ./listmonk/uploads; move the old folder aside first
Into a fresh database, before listmonk starts against it:
docker compose up -d listmonk-db
docker compose exec -T listmonk-db psql -U listmonk listmonk < "$BACKUP/listmonk.sql"
Put ./listmonk/uploads back, then:
docker compose up -d
Sources:
- listmonk docs: Upgrade (back up Postgres first; Docker steps): https://github.com/knadh/listmonk/blob/master/docs/docs/content/upgrade.md (checked 2026-10-03)
- PostgreSQL docs: pg_dump (consistent backups while the database is in use): https://www.postgresql.org/docs/current/app-pgdump.html (checked 2026-10-03)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-10-03)
Update it
What docker compose pull does depends only on how each image line in the compose file above is tagged. For listmonk as this page writes it:
| Service | Image | How it is pinned | What docker compose pull does |
|---|---|---|---|
caddy | caddy:2 | Major version only (tag 2) | Takes the newest image tagged 2: minor and patch releases of 2, never 3. A new major version needs a tag edit. |
listmonk-app | listmonk/listmonk:latest | Not pinned: moving tag latest | Moves to the newest image published as latest, which can be a new major version. |
listmonk-db database | postgres:17-alpine | Major version only (tag 17-alpine) | Takes the newest image tagged 17-alpine: minor and patch releases of 17, never 18. A new major version needs a tag edit. |
Do not raise the major version of listmonk-db by editing its tag. Keep its tag, 17-alpine, as it is when you update listmonk.
PostgreSQL's docs: a new major version may change how data is stored on disk, so a data folder written by an older major version will not start under a newer one (the server refuses it). Moving needs a dump and restore (pg_dumpall, then load the dump into the new version) or pg_upgrade. Minor releases of the same major version never change the storage format. Source: PostgreSQL docs: Upgrading a PostgreSQL Cluster checked 2026-09-30
What listmonk's docs say about updating
listmonk's upgrade page, Docker, for this compose file: back up the database, then
docker compose down app docker compose pull docker compose up app -d
- In this file the service is listmonk-app. The app runs ./listmonk --upgrade on start, so the new version migrates the database itself; the page warns that a migrated database cannot go back to an older version without the backup.
The steps
- Back up first, as in Back it up above. An update can migrate listmonk's data on its first start and its database with it; the copy is the way back.
- Download the new images. Running containers are not touched yet:
docker compose pull
- Recreate the containers whose image changed. Volumes and bind-mounted folders stay as they are:
docker compose up -d
- Watch listmonk start (Ctrl+C stops following the log, not the app):
docker compose logs -f listmonk-app
- Optional: remove the old images the pull left without a tag. This covers every stack on the machine, not only this one:
docker image prune
Sources
Every page below was fetched on the date shown.
- listmonk on GitHub (repository description) checked 2026-10-03 (what it does)
- listmonk: docker-compose.yml (app and Postgres, install and upgrade on start, LISTMONK_* variables) checked 2026-10-03 (compose definition and proxy settings)
- listmonk docs: Installation (Docker, Super Admin on first start) checked 2026-10-03 (compose definition and proxy settings)
- listmonk docs: Upgrade (back up Postgres first; Docker steps) checked 2026-10-03 (compose definition and proxy settings, backup plan, update notes)
- listmonk docs: Configuration (environment variables, HTTP routes, media uploads) checked 2026-10-03 (compose definition and proxy settings)
- Caddy docs: Keep Caddy running (Docker Compose section) checked 2026-09-23 (Caddy)
- Vaultwarden wiki: Caddy with HTTP challenge (uses the caddy:2 image) checked 2026-09-23 (Caddy)
- PostgreSQL docs: pg_dump (consistent backups while the database is in use) checked 2026-10-03 (backup plan)
- Docker docs: Volumes, Back up, restore, or migrate data volumes checked 2026-10-03 (backup plan)
- Caddy docs: Conventions, Data directory checked 2026-09-24 (backup plan)
- PostgreSQL docs: Upgrading a PostgreSQL Cluster checked 2026-09-30 (database upgrade)
- Docker docs: docker compose pull checked 2026-09-30 (update steps)
- Docker docs: docker compose up (recreates changed containers, keeps volumes) checked 2026-09-30 (update steps)
- Docker docs: docker image prune checked 2026-09-30 (update steps)