Install Docmost using Docker on Rocky Linux 10 to run a private, collaborative documentation workspace with PostgreSQL, Redis, and automatic HTTPS. With DNS already prepared, you can reach the workspace setup page in about 15 minutes.
Prerequisites
- A 64-bit Rocky Linux 10 VPS with at least 2 GB of RAM and 10 GB of free disk space. Allocate more storage if users will upload many files.
- SSH access as
root, or a regular Linux account with workingsudoprivileges. - A domain such as
YOUR_DOMAINwith an A record pointing toSERVER_IP. Caddy needs this hostname to request and renew a trusted TLS certificate. - Provider-level inbound TCP access for ports 80 and 443. Docmost’s application port will stay private on the server.
- A VPSLake Linux VPS if you need a Rocky Linux server with root access.
The commands use sudo for a normal SSH account. If you are logged in as root, remove sudo. Rocky Linux 10 uses DNF and firewalld, and SELinux remains enabled throughout this setup.
Step 1: Confirm Rocky Linux 10 and update the host
Why: Checking the release and architecture first keeps the Docker repository and packages aligned with the Rocky Linux 10 host.
. /etc/os-release
printf '%s\n' "$PRETTY_NAME"
printf 'Release: %s\n' "$VERSION_ID"
uname -m
sudo dnf upgrade -y
The output should identify Rocky Linux 10 and a 64-bit architecture:
Rocky Linux 10.x (Red Quartz)
Release: 10.x
x86_64
The exact minor release changes as Rocky publishes updates. Resolve any DNF mirror, DNS, or GPG-signature error before continuing.
Step 2: Install Docker Engine and Compose
Why: Docker Engine runs the application containers, while the Compose plugin starts Docmost and its PostgreSQL, Redis, and Caddy services together.
On a fresh VPS, remove packages that can conflict with Docker’s runtime. Skip this removal on a host that already runs important Podman containers until you have reviewed those workloads.
sudo dnf remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine podman runc
sudo dnf install -y dnf-plugins-core ca-certificates curl openssl
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf makecache
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
This follows Docker’s official RHEL installation method, which supports the RHEL-compatible package path used by Rocky Linux 10. Keep using sudo docker instead of adding your login to the docker group; that group grants root-equivalent control.
Check the daemon, Compose plugin, and a disposable 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; package patch versions will vary:
active
Client 29.x.y / Server 29.x.y
Docker Compose version v2.x.y
Hello from Docker!
Step 3: Create Docmost’s protected settings
Why: Docmost needs a durable application secret, and PostgreSQL must receive one identical password from both the database service and the application connection string.
Generate hexadecimal values so the database password is safe to place in a connection URL. Then create a deployment directory that your sudo account can enter while the secret file itself stays root-readable only.
openssl rand -hex 32
openssl rand -hex 24
sudo install -d -m 0755 /opt/docmost
cd /opt/docmost
sudo vi .env
In vi, create /opt/docmost/.env. Use the first random value for APP_SECRET, the second for DB_PASSWORD, and replace YOUR_DOMAIN with the real hostname:
APP_URL=https://YOUR_DOMAIN
APP_SECRET=REPLACE_WITH_64_HEX_CHARACTERS
DB_PASSWORD=REPLACE_WITH_48_HEX_CHARACTERS
Save the file and restrict access to the database credential:
sudo chmod 600 /opt/docmost/.env
sudo chown root:root /opt/docmost/.env
The openssl rand -hex 32 command creates a 64-character secret, which is longer than Docmost’s minimum. APP_URL must match the HTTPS hostname exactly, including any subdomain.
Step 4: Add Caddy and the Compose stack
Why: Caddy handles certificate issuance and WebSocket proxying, while the Compose volumes keep the wiki’s data when containers are recreated.
Create the Caddy configuration first. The official Docmost Caddy guide uses this service-name proxy pattern for HTTPS deployments.
sudo vi /opt/docmost/Caddyfile
Enter the following and replace YOUR_DOMAIN with the same hostname used in .env:
YOUR_DOMAIN {
reverse_proxy docmost:3000
}
Now create /opt/docmost/docker-compose.yml:
sudo vi /opt/docmost/docker-compose.yml
Paste this definition:
services:
caddy:
image: caddy:2
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
- 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 :Z suffix lets Docker apply an SELinux label to the Caddy bind mount without turning SELinux off. Binding Docmost to 127.0.0.1 prevents direct public access to port 3000; Caddy reaches the service through the private Compose network. The named volumes preserve pages, uploads, database records, Redis data, and certificates.
Step 5: Open firewalld and launch Docmost
Why: The host firewall should expose only the web endpoints required by Caddy, while PostgreSQL, Redis, and the application remain unreachable from the internet.
Install and enable firewalld, preserve SSH access, and open HTTP and HTTPS for web traffic and certificate issuance:
sudo dnf install -y firewalld
sudo systemctl enable --now firewalld
sudo firewall-cmd --permanent --zone=public --add-service=ssh
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-services
You should see ssh, http, and https. If SSH listens on a custom port, add that port instead of the ssh service before enabling the firewall. Confirm the rendered Compose configuration, download the images, and start the stack:
cd /opt/docmost
sudo docker compose config --quiet
sudo docker compose pull
sudo docker compose up -d
sudo docker compose ps
The first pull may take several minutes. A healthy result has four services in an Up state; only Caddy should show public port mappings:
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 choose different container names. If a service keeps restarting, inspect its logs before opening the site.
Verify the Docmost installation
Why: An HTTPS request through the domain checks DNS, firewalld, Caddy’s certificate, the reverse proxy, and Docmost’s listener in one pass.
curl -fsS -o /dev/null -w 'HTTP %{http_code}\n' https://YOUR_DOMAIN
Expected output:
HTTP 200
Open https://YOUR_DOMAIN in a browser. The Docmost workspace setup page should appear. Enter a workspace name, administrator details, and a unique strong password, then create a page and edit it in a second browser tab to check the collaborative editor.
Review recent logs after the first login:
cd /opt/docmost
sudo docker compose logs --tail=40 caddy docmost db redis
The output should not contain a repeating restart loop, a PostgreSQL authentication error, or an ACME certificate failure.
Troubleshooting
docker: command not found
The Docker repository package installation did not complete, or the shell has not refreshed its command path. Check the installation transaction and retry the package command; do not install the unrelated podman-docker compatibility package alongside Docker Engine.
sudo dnf list installed 'docker*' containerd.io docker-compose-plugin
sudo systemctl status docker --no-pager
If the list is empty, rerun Step 2 and check the DNF error rather than starting the Compose stack.
WARNING: The "DB_PASSWORD" variable is not set
Compose cannot read the .env file, or the variable name in that file does not match the name in docker-compose.yml. Confirm the file location and permissions, then validate the project from its directory:
cd /opt/docmost
sudo grep -E '^(APP_URL|APP_SECRET|DB_PASSWORD)=' .env
sudo docker compose config --quiet
The grep output should show all three keys without exposing the values in this guide. If a key is missing, edit .env and recreate the affected services.
Caddy returns 502 Bad Gateway
Caddy is reachable, but Docmost is still starting or has exited because a dependency or environment value is invalid. Check the service states and recent application logs:
cd /opt/docmost
sudo docker compose ps
sudo docker compose logs --tail=80 docmost db redis
Correct the reported error, then run sudo docker compose up -d again. Do not delete the named volumes while diagnosing a live installation.
Caddy cannot obtain a certificate
The domain may still point to another address, or port 80/443 may be blocked by the VPS provider firewall. Verify that YOUR_DOMAIN resolves to SERVER_IP, allow both ports in the provider firewall, and confirm the host rules with sudo firewall-cmd --zone=public --list-services.
Hardening and maintenance
- Keep port 3000 bound to
127.0.0.1; never publish PostgreSQL or Redis ports for routine web access. - Back up the
docmost,db_data,redis_data,caddy_data, andcaddy_configvolumes before upgrades or host maintenance. - Update deliberately from
/opt/docmostwithsudo docker compose pullfollowed bysudo docker compose up -d, and review the logs afterward. - Keep
.envat mode600and use a different long password for the Docmost administrator account.
FAQ
Can I use an IP address instead of a domain?
You can test the application over an IP address, but Caddy cannot obtain a normal public certificate for that address. A domain is the practical choice for a secure public workspace and reliable browser WebSocket connections.
Why is port 3000 bound to loopback?
Docmost does not need to be directly exposed because Caddy is the public entry point. The loopback binding removes a second unauthenticated route and leaves TLS, certificate handling, and web access policy in one place.
Where is the workspace data stored?
Uploaded files are in the docmost volume, PostgreSQL records are in db_data, and Redis persistence is in redis_data. Caddy’s certificate state uses caddy_data and caddy_config; include all five volumes in your backup plan.
What happens if I run docker compose down?
The containers and network stop, but named volumes remain unless you add -v. Start the deployment again from /opt/docmost with sudo docker compose up -d; never use down -v on a workspace whose data you need.