How to Install Docmost with Docker
Table of contents
- Key takeaways
- What is Docmost and how does it differ from Confluence?
- What do you need before you start?
- The Docmost docker-compose.yml
- APP_SECRET and environment variables
- How do you publish it with HTTPS?
- Workspaces and real-time collaboration
- Frequently asked questions
- Do I really need PostgreSQL and Redis to use Docmost?
- Why should I not use the image's latest tag?
- Where are the files I upload to pages stored?
- Conclusion
- Sources
Docmost is an open-source wiki and knowledge base, a self-hosted alternative to Confluence and Notion. On Docker it runs as three containers: the application, a PostgreSQL database and a Redis cache. A single docker-compose.yml file gives you workspaces, real-time collaborative editing and full control over your documents.
Docmost is an open-source collaborative wiki that installs in minutes with Docker. In this guide you bring up the application alongside a PostgreSQL database and a Redis cache using a single docker-compose.yml file, generate the mandatory APP_SECRET, configure the environment variables and learn to organise content into workspaces with real-time editing. The same explanation is available in Spanish.
Key takeaways
- Docmost is an open-source wiki and knowledge base, a self-hosted alternative to Confluence and Notion, released under the AGPL-3.0 licence.
- The recommended setup uses three containers: the application (the official
docmost/docmostimage), a PostgreSQL database and a Redis cache that also powers real-time collaboration. - You need an
APP_SECRETof at least 32 characters; generate it withopenssl rand -hex 32. Without it, Docmost will not start. - Pin a specific image version (for example
docmost/docmost:0.95.0) instead of:latest, so you decide when you update. - Attachments live in the
/app/data/storagevolume and the database in its own volume, so your documents persist even if you recreate the containers.
What is Docmost and how does it differ from Confluence?
Docmost is an open-source platform for building wikis and knowledge bases: a self-hosted replacement for Atlassian’s Confluence and for Notion. You organise documentation into workspaces, write with a modern block editor and collaborate with your team in real time, all on a server you control.
The main difference from Confluence is the model: Docmost runs on your own infrastructure, with no per-user fees and no data in a third party’s cloud. Its core is free under the AGPL-3.0 licence and the project has around 21,000 stars on GitHub. Against Notion, the advantage is the same data sovereignty, plus the ability to export, back up and audit everything you write. It includes group permissions, page history, comments, search and diagrams with Draw.io, Excalidraw and Mermaid.
What do you need before you start?
You need a Linux machine with Docker and the Compose plugin already installed. If you do not have it yet, follow the guide to install Docker on Ubuntu 24.04 first. For small-team use, 2 GB of RAM and a couple of cores are enough.
The setup relies on two data services you may want to get to know separately: the PostgreSQL database, where Docmost stores pages, spaces and users, and Redis, which acts as a cache and as the channel for real-time WebSocket collaboration. In this tutorial we define them inside the same docker-compose.yml, so there is no need to install them separately.
The Docmost docker-compose.yml
Create a folder for the project and save this docker-compose.yml inside it. Before starting, replace the database password and paste your own APP_SECRET (we generate it in the next section):
services:
docmost:
image: docmost/docmost:0.95.0
restart: unless-stopped
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
environment:
APP_URL: "http://localhost:3000"
APP_SECRET: "paste_your_generated_secret_here"
DATABASE_URL: "postgresql://docmost:change_this_db_key@db:5432/docmost?schema=public"
REDIS_URL: "redis://redis:6379"
ports:
- "3000:3000"
volumes:
- docmost_data:/app/data/storage
db:
image: postgres:18
restart: unless-stopped
environment:
POSTGRES_DB: docmost
POSTGRES_USER: docmost
POSTGRES_PASSWORD: change_this_db_key
volumes:
- db_data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U docmost -d docmost"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:8-alpine
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
docmost_data:
db_data:
redis_data:
Notice a few details. The application does not start until PostgreSQL and Redis pass their healthcheck, thanks to depends_on with the service_healthy condition. The container’s port 3000 is published on the host’s port 3000, so Docmost will be at http://localhost:3000. Attachments are stored in the docmost_data volume, mounted at /app/data/storage, and the database in db_data.
APP_SECRET and environment variables
The APP_SECRET encrypts Docmost’s sessions and tokens, so it is mandatory and must be at least 32 characters long. Generate a random one with OpenSSL and paste it into the APP_SECRET value in the Compose file:
openssl rand -hex 32
That command returns a 64-character hexadecimal string, more than enough. These are the four variables you need to review:
APP_URL: the public address you will use to reach Docmost. Locally it ishttp://localhost:3000; in production, the full HTTPS URL, for examplehttps://wiki.mydomain.com.APP_SECRET: the key you just generated. Do not share it or commit it to a repository.DATABASE_URL: the PostgreSQL connection string. The user and password must match those of thedbservice.REDIS_URL: the Redis connection, which inside the Compose network is alwaysredis://redis:6379.
With the file and the secret ready, start the stack in the background and check that all three services are healthy:
docker compose up -d
docker compose ps
docker compose logs -f docmost
The first time, the application runs the database migrations, so the boot takes a little longer. When the log stops moving, open http://localhost:3000 and create the first account: that user becomes the workspace administrator.
How do you publish it with HTTPS?
Docmost needs HTTPS in production, because collaborative editing uses WebSockets and the browser requires a secure origin. Serving it over plain HTTP would leave sessions unencrypted. The usual way to give it a valid certificate is to place it behind a reverse proxy that handles TLS for you. If you are following the series, you will already have Traefik with Docker Compose running; in that case, remove the ports section from the docmost service, connect it to the proxy network and add these labels:
labels:
- "traefik.enable=true"
- "traefik.http.routers.docmost.rule=Host(`wiki.mydomain.com`)"
- "traefik.http.routers.docmost.entrypoints=websecure"
- "traefik.http.routers.docmost.tls.certresolver=le"
- "traefik.http.services.docmost.loadbalancer.server.port=3000"
Traefik will request the certificate from Let’s Encrypt and renew it automatically. Remember to change APP_URL to your real domain with https://, because Docmost uses that value to build the links and the editor connections.
Workspaces and real-time collaboration
Inside Docmost, all content is organised into spaces: groups of pages with their own permissions, designed to separate teams or projects. Within each space, pages nest in a tree hierarchy, so you can build anything from a small handbook to a knowledge base with hundreds of documents.
Real-time collaboration is one of its best features: several people can edit the same page at once and see the changes instantly, just like in Notion. This relies on Redis, which synchronises the editor state across the open sessions; that is why the Redis container is not optional. Each page keeps its version history, supports inline comments and lets you insert Draw.io, Excalidraw and Mermaid diagrams without leaving the editor. Permissions are assigned by group, so you control who reads and who writes in each space.
Frequently asked questions
Do I really need PostgreSQL and Redis to use Docmost?
Yes, both are mandatory. Docmost does not support SQLite: it stores all its data in PostgreSQL, so the database is essential. Redis is not optional either, because besides being a cache it is the channel that synchronises real-time collaborative editing across sessions. The three containers make up the minimum configuration.
Why should I not use the image’s latest tag?
Because :latest changes without warning and could move you up a major version during a simple restart, dragging in database migrations you did not expect. By pinning docmost/docmost:0.95.0 you decide when you update, review the release notes first and avoid surprises in a service that stores important documentation.
Where are the files I upload to pages stored?
By default, in the local volume mounted at /app/data/storage inside the container, with the local storage driver. If you prefer object storage, Docmost supports an S3-compatible backend, which you can cover with MinIO; in that case attachments travel to the bucket instead of the server’s disk.
Conclusion
With a single docker-compose.yml you have a complete collaborative wiki: application, database and cache, with documents that never leave your server. The logical next step is to take it to the Internet securely behind Traefik and create your first workspace. If you want an alternative with single sign-on and S3 storage, compare Docmost with Outline, the other self-hosted wiki in this series.