Install Docmost using Docker on Rocky Linux 8 to run a private collaborative wiki with PostgreSQL, Redis, and HTTPS. With DNS ready, you can reach the workspace setup page in about 15 minutes.
Prerequisites
- A 64-bit Rocky Linux 8 VPS with at least 2 GB of RAM and 10 GB of free disk space. Reserve more disk space 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 needs the hostname to request a TLS certificate. - Provider-level access for inbound TCP ports 80 and 443. Docmost’s application port will remain private on the server.
- A VPSLake Linux VPS if you need a Rocky Linux server with root access.
The commands below use sudo for a normal SSH account. If you are logged in as root, remove sudo. Rocky Linux 8 uses DNF and firewalld, and SELinux stays enabled throughout this guide.
Step 1: Check Rocky Linux 8 and update the host
Why: Confirming the release and architecture first helps prevent an incorrect repository or package set from being applied.
. /etc/os-release
printf '%s\n' "$PRETTY_NAME"
printf 'Release: %s\n' "$VERSION_ID"
uname -m
sudo dnf upgrade -y
The release should identify Rocky Linux 8 and a 64-bit architecture:
Rocky Linux 8.x (Green Obsidian)
Release: 8.x
x86_64
Minor release and kernel text will change as updates arrive. Resolve any mirror, DNS, or GPG-signature error before continuing.
Step 2: Install Docker Engine and Compose
Why: Docker runs the application containers, while the Compose plugin starts Docmost, PostgreSQL, Redis, and Caddy from one definition.
On a new VPS, remove packages that can conflict with Docker’s runtime. Skip the removal until you have reviewed active containers if this host already runs Podman or another container engine.
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 uses Docker’s official RHEL installation method with the RHEL-compatible repository. Keep using sudo docker in this guide; membership in the docker group grants root-equivalent control of the host.
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; 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 protected Docmost settings
Why: Docmost needs a long application secret, and PostgreSQL must receive one matching password from both the database container and the application URL.
Generate hexadecimal values so the database password is safe to place in a connection string. Then create the deployment directory and environment file:
openssl rand -hex 32
openssl rand -hex 24
sudo install -d -m 0755 /opt/docmost
sudo vi /opt/docmost/.env
Create /opt/docmost/.env in vi. 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 it because it contains a database credential:
sudo chmod 600 /opt/docmost/.env
sudo chown root:root /opt/docmost/.env
The first command generates a 64-character secret, exceeding Docmost’s 32-character minimum. APP_URL must exactly match the hostname that visitors will use, including any subdomain.
Step 4: Define the HTTPS proxy and application stack
Why: Caddy obtains certificates and forwards WebSockets for the real-time editor, while named volumes keep the wiki data outside disposable container layers.
Create the Caddy configuration. The official Docmost Caddy guide uses this service-name proxy pattern:
sudo vi /opt/docmost/Caddyfile
Enter this content, using the same hostname as .env:
YOUR_DOMAIN {
reverse_proxy docmost:3000
}
Now create the Compose file:
sudo vi /opt/docmost/docker-compose.yml
Paste the following 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 option gives the Caddy bind mount an SELinux label without disabling SELinux. Binding Docmost to 127.0.0.1 prevents direct public access to port 3000; Caddy reaches it through the private Compose network. The volumes preserve pages, uploads, database records, Redis data, and certificates.
Step 5: Open firewalld and launch Docmost
Why: The firewall should expose SSH and Caddy’s web ports while PostgreSQL, Redis, and the application listener stay off the public interface.
Enable firewalld and allow the services needed for administration, HTTP redirects, and HTTPS 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 in the result. If SSH uses a custom port, add that port instead of the ssh service before enabling firewalld, or you may lock yourself out.
Validate the rendered 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 image pull may take several minutes. A healthy result has four services in an Up state, with Docmost bound only to loopback:
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. A service that repeatedly restarts needs its logs checked before you open the site.
Verify the Docmost installation
Why: One HTTPS request checks DNS, firewalld, Caddy’s certificate, the reverse proxy, and Docmost’s health endpoint together.
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 details, and a unique strong password, then create a test page and edit it in a second browser tab to check the collaborative editor.
Troubleshooting
No match for argument: docker-ce
The Docker repository was not added, DNF has stale metadata, or the wrong repository endpoint is configured. Re-add the RHEL-compatible repository and refresh the cache:
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf clean all
sudo dnf makecache
sudo dnf repolist | grep -i docker
The last command should show Docker’s stable repository before you retry the package installation.
Caddy logs permission denied for Caddyfile
SELinux is correctly blocking an unlabeled bind mount. Confirm the Caddy service mount ends with :ro,Z, then recreate only that service:
cd /opt/docmost
sudo docker compose up -d --force-recreate caddy
sudo docker compose logs --tail=40 caddy
Do not disable SELinux to work around this error.
The browser shows 502 Bad Gateway
Caddy cannot reach Docmost, usually because the application container is still starting or has exited. Check both the service state and recent logs:
cd /opt/docmost
sudo docker compose ps
sudo docker compose logs --tail=80 docmost
Wait for the database initialization to finish. If the logs show a bad connection string or secret, correct .env and recreate the stack with sudo docker compose up -d --force-recreate.
Caddy cannot obtain a certificate
The domain may not resolve to this VPS, or TCP 80 and 443 may be blocked by the provider firewall. Check DNS from another network, allow both ports at the provider, and inspect Caddy’s error:
cd /opt/docmost
sudo docker compose logs --tail=80 caddy
Use the domain—not the server IP—in both Caddyfile and APP_URL.
Hardening and maintenance
- Keep port 3000, PostgreSQL, and Redis unpublished. Only Caddy needs public web ports.
- Back up the
docmost,db_data, andredis_datavolumes before upgrades or server changes. A VPS snapshot is useful, but keep a separate copy of important documentation. - Update Rocky Linux regularly, then review and pull new container images during a maintenance window:
cd /opt/docmost
sudo docker compose pull
sudo docker compose up -d
- Never commit
/opt/docmost/.envto a repository or paste its values into support tickets.
FAQ
Can I run Docmost with only a server IP address?
You can test the application over plain HTTP, but Caddy cannot obtain a trusted certificate for a bare IP in the normal setup. A DNS name is the practical choice for a secure public deployment and is required by the HTTPS configuration in this guide.
Why are PostgreSQL and Redis separate containers?
Docmost expects PostgreSQL for its application data and Redis for cache and real-time coordination. Keeping them on the private Compose network avoids exposing either service directly to the internet.
Where are Docmost pages and uploads stored?
Pages and uploaded files are stored in the docmost named volume. PostgreSQL records, Redis persistence, and Caddy’s certificate state are stored in their respective volumes, so recreating containers does not by itself erase the workspace.
How do I upgrade without deleting the wiki?
Back up the named volumes first, then run docker compose pull and docker compose up -d from /opt/docmost. Do not add -v to docker compose down or remove the named volumes, because those actions can delete the application data.