Install Docmost using Docker on Ubuntu 24.04 to run a collaborative documentation workspace behind HTTPS. With DNS already pointed to your VPS, you can reach the workspace setup screen in about 15 minutes.
Prerequisites
- A 64-bit Ubuntu 24.04 LTS VPS with at least 2 GB of RAM and 10 GB of free disk space. Reserve more storage if users will upload many files.
- SSH access as
root, or a normal Linux account with workingsudoprivileges. - A domain such as
YOUR_DOMAINwith an A record pointing toSERVER_IP; Caddy uses it to obtain and renew the TLS certificate. - Inbound TCP ports 80 and 443 available at both the VPS provider and the server firewall. Docmost’s application port will remain private.
- A VPSLake Linux VPS if you need an Ubuntu server with root access.
The commands use sudo for a regular SSH account. If you are logged in as root, remove sudo from each command.
Step 1: Confirm Ubuntu 24.04 and update the server
Why: Confirming the release codename before adding Docker’s repository prevents Apt from receiving packages for the wrong Ubuntu version.
. /etc/os-release
printf '%s\n' "$PRETTY_NAME"
printf 'Codename: %s\n' "$VERSION_CODENAME"
uname -m
sudo apt-get update
sudo apt-get upgrade -y
The checks should identify Noble and a supported 64-bit architecture:
Ubuntu 24.04.x LTS
Codename: noble
x86_64
The patch number may differ. Resolve any Apt mirror, DNS, or signature error before installing Docker. Docker’s official Ubuntu installation guide supports Ubuntu 24.04 and the repository method used below.
Step 2: Install Docker Engine and Compose
Why: Docker runs the application containers, while the Compose plugin starts Docmost, PostgreSQL, Redis, and Caddy as one stack.
On a fresh VPS, remove packages that can conflict with Docker’s official packages. Do not run the removal command on a host with important existing containers until you have reviewed those workloads.
sudo apt-get remove -y docker.io docker-compose docker-compose-v2 docker-doc docker-buildx podman-docker containerd runc
sudo apt-get install -y ca-certificates curl openssl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources > /dev/null <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
Check the daemon, Compose plugin, and a disposable test container:
sudo systemctl is-active docker
sudo docker version --format 'Client {{.Client.Version}} / Server {{.Server.Version}}'
sudo docker compose version
sudo docker run --rm hello-world
Expected output is similar to this; the version numbers will change:
active
Client 29.x.y / Server 29.x.y
Docker Compose version v2.x.y
Hello from Docker!
Hello from Docker!
Keep using sudo docker in this guide. Adding a user to the docker group removes the password prompt but grants that account root-equivalent control of the server.
Step 3: Generate Docmost’s protected settings
Why: Docmost needs a persistent application secret, and PostgreSQL needs the same database password in both its container settings and the application connection URL.
Generate hex values so the database password is safe inside a connection string, then create the deployment directory:
openssl rand -hex 32
openssl rand -hex 24
sudo install -d -m 0755 /opt/docmost
sudo nano /opt/docmost/.env
Create /opt/docmost/.env in the editor:
APP_URL=https://YOUR_DOMAIN
APP_SECRET=REPLACE_WITH_64_HEX_CHARACTERS
DB_PASSWORD=REPLACE_WITH_48_HEX_CHARACTERS
Replace YOUR_DOMAIN with the hostname users will open. Put the first command’s 64-character result in APP_SECRET and the second command’s 48-character result in DB_PASSWORD; do not leave the uppercase examples in the file.
Save the file and make the credentials readable only by root:
sudo chmod 600 /opt/docmost/.env
sudo chown root:root /opt/docmost/.env
The official Docmost installation documentation requires an application secret of at least 32 characters and uses PostgreSQL, Redis, and the /api/health endpoint shown later.
Step 4: Add Caddy and the Compose definition
Why: Caddy handles automatic HTTPS and WebSocket proxying, while named Docker volumes keep the wiki data when containers are recreated.
Create /opt/docmost/Caddyfile:
sudo nano /opt/docmost/Caddyfile
Paste this configuration and replace YOUR_DOMAIN with the same hostname used in .env:
YOUR_DOMAIN {
reverse_proxy docmost:3000
}
Now create the Compose file:
sudo nano /opt/docmost/docker-compose.yml
Paste this definition:
services:
caddy:
image: caddy:2
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
depends_on:
- docmost
restart: unless-stopped
docmost:
image: docmost/docmost:latest
depends_on:
- db
- redis
environment:
APP_URL: "${APP_URL}"
APP_SECRET: "${APP_SECRET}"
DATABASE_URL: "postgresql://docmost:${DB_PASSWORD}@db:5432/docmost"
REDIS_URL: "redis://redis:6379"
ports:
- "127.0.0.1:3000:3000"
restart: unless-stopped
volumes:
- docmost:/app/data/storage
db:
image: postgres:18
environment:
POSTGRES_DB: docmost
POSTGRES_USER: docmost
POSTGRES_PASSWORD: "${DB_PASSWORD}"
restart: unless-stopped
volumes:
- db_data:/var/lib/postgresql
redis:
image: redis:8
command: ["redis-server", "--appendonly", "yes", "--maxmemory-policy", "noeviction"]
restart: unless-stopped
volumes:
- redis_data:/data
volumes:
docmost:
db_data:
redis_data:
caddy_data:
caddy_config:
The 127.0.0.1 binding keeps port 3000 off the public network; only Caddy can reach the application through Docker’s private network. The named volumes preserve pages, uploads, PostgreSQL records, Redis persistence, and Caddy’s certificate state.
Step 5: Allow web traffic and start Docmost
Why: UFW should allow SSH and Caddy’s web ports while keeping the application, database, and cache inaccessible from the internet.
Install UFW, preserve SSH access, then open only HTTP and HTTPS:
sudo apt-get install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
sudo ufw status verbose
The status should be active and include the three required rules:
Status: active
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
OpenSSH ALLOW Anywhere
If SSH uses a custom port, allow that port before enabling UFW instead of using OpenSSH. You can also generate a matching ruleset with VPSLake’s UFW firewall generator.
Docker warns that published container ports can bypass some UFW filtering paths. This layout publishes only Caddy’s ports and binds Docmost to loopback, so do not change the application mapping to 3000:3000 unless you intentionally want a separate firewall design.
Validate the rendered configuration, download the images, and launch the services:
cd /opt/docmost
sudo docker compose config --quiet
sudo docker compose pull
sudo docker compose up -d
sudo docker compose ps
The first image pull may take several minutes. A healthy result has four services in an Up state:
NAME SERVICE STATUS PORTS
docmost-caddy-1 caddy Up 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp
docmost-docmost-1 docmost Up 127.0.0.1:3000->3000/tcp
docmost-db-1 db Up
docmost-redis-1 redis Up
Compose may select different container names. A service that repeatedly restarts needs its logs checked before you open the site.
Verify the Docmost installation
Why: An HTTPS health request checks DNS, the certificate, Caddy’s proxy route, and Docmost’s HTTP listener in one pass.
curl -fsS -o /dev/null -w 'HTTP %{http_code}\n' https://YOUR_DOMAIN/api/health
Expected output:
HTTP 200
Open https://YOUR_DOMAIN in a browser. The Docmost workspace setup page should appear; enter a workspace name, administrator name, email address, and a strong unique password. Create a test page and edit it in a second browser tab to confirm the editor and WebSocket connection work.
Troubleshooting
permission denied while trying to connect to the Docker daemon socket
The current account cannot access Docker’s Unix socket. Run the commands as shown with sudo; if the daemon itself is stopped, start it and check its state:
sudo systemctl enable --now docker
sudo systemctl is-active docker
Caddy cannot obtain a certificate
This usually means YOUR_DOMAIN does not resolve to SERVER_IP, or a provider firewall blocks port 80 or 443. Check the DNS record, allow both ports in the VPS control panel, and inspect Caddy’s log:
cd /opt/docmost
sudo docker compose logs --tail=80 caddy
The browser shows 502 Bad Gateway
Caddy is running, but Docmost is not answering on the private network. Check all services and read the application log, then retry the stack after fixing any missing secret or database error:
cd /opt/docmost
sudo docker compose ps
sudo docker compose logs --tail=100 docmost db redis
sudo docker compose up -d
Bind for 0.0.0.0:80 failed: port is already allocated
Another web server is already using port 80 or 443. Identify the process with sudo ss -ltnp, then stop or reconfigure that service, or place Caddy behind the existing reverse proxy and remove the conflicting host port mapping.
FAQ
Can I install Docmost without a domain name?
You can test the application locally, but this guide uses Caddy’s automatic HTTPS and therefore expects a DNS name. An IP-only deployment would need a different proxy and certificate plan, so it is not a good production setup for a shared documentation workspace.
Why is port 3000 not open in the firewall?
Docmost listens on loopback and Caddy forwards public HTTPS traffic to it over Docker’s private network. Keeping 3000 private avoids exposing the application without the TLS and proxy layer.
How do I update Docmost later?
Back up your Docker volumes first, then pull current images and recreate changed services from /opt/docmost:
cd /opt/docmost
sudo docker compose pull
sudo docker compose up -d
Where does Docmost store its data?
Pages and uploaded files are in the docmost volume, PostgreSQL uses db_data, Redis uses redis_data, and Caddy stores certificates in caddy_data. Back up these volumes or an equivalent export before upgrades and server maintenance.