{"id":1121,"date":"2026-11-19T09:00:00","date_gmt":"2026-11-19T09:00:00","guid":{"rendered":"https:\/\/vpslake.com\/blog\/?p=1121"},"modified":"2026-11-19T09:00:00","modified_gmt":"2026-11-19T09:00:00","slug":"install-docmost-docker-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/vpslake.com\/blog\/2026\/11\/19\/install-docmost-docker-ubuntu-24-04\/","title":{"rendered":"How to Install Docmost Using Docker on Ubuntu 24.04"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>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.<\/li>\n\n\n<li>SSH access as <code>root<\/code>, or a normal Linux account with working <code>sudo<\/code> privileges.<\/li>\n\n\n<li>A domain such as <code>YOUR_DOMAIN<\/code> with an A record pointing to <code>SERVER_IP<\/code>; Caddy uses it to obtain and renew the TLS certificate.<\/li>\n\n\n<li>Inbound TCP ports 80 and 443 available at both the VPS provider and the server firewall. Docmost\u2019s application port will remain private.<\/li>\n\n\n<li>A <a href=\"https:\/\/vpslake.com\/buy-vps\">VPSLake Linux VPS<\/a> if you need an Ubuntu server with root access.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The commands use <code>sudo<\/code> for a regular SSH account. If you are logged in as <code>root<\/code>, remove <code>sudo<\/code> from each command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Confirm Ubuntu 24.04 and update the server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: Confirming the release codename before adding Docker\u2019s repository prevents Apt from receiving packages for the wrong Ubuntu version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>. \/etc\/os-release\nprintf '%s\\n' \"$PRETTY_NAME\"\nprintf 'Codename: %s\\n' \"$VERSION_CODENAME\"\nuname -m\nsudo apt-get update\nsudo apt-get upgrade -y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The checks should identify Noble and a supported 64-bit architecture:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Ubuntu 24.04.x LTS\nCodename: noble\nx86_64<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The patch number may differ. Resolve any Apt mirror, DNS, or signature error before installing Docker. Docker\u2019s <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" target=\"_blank\" rel=\"noopener\">official Ubuntu installation guide<\/a> supports Ubuntu 24.04 and the repository method used below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install Docker Engine and Compose<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: Docker runs the application containers, while the Compose plugin starts Docmost, PostgreSQL, Redis, and Caddy as one stack.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On a fresh VPS, remove packages that can conflict with Docker\u2019s official packages. Do not run the removal command on a host with important existing containers until you have reviewed those workloads.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get remove -y docker.io docker-compose docker-compose-v2 docker-doc docker-buildx podman-docker containerd runc\nsudo apt-get install -y ca-certificates curl openssl\nsudo install -m 0755 -d \/etc\/apt\/keyrings\nsudo curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg -o \/etc\/apt\/keyrings\/docker.asc\nsudo chmod a+r \/etc\/apt\/keyrings\/docker.asc\nsudo tee \/etc\/apt\/sources.list.d\/docker.sources &gt; \/dev\/null &lt;&lt;EOF\nTypes: deb\nURIs: https:\/\/download.docker.com\/linux\/ubuntu\nSuites: $(. \/etc\/os-release &amp;&amp; echo \"${UBUNTU_CODENAME:-$VERSION_CODENAME}\")\nComponents: stable\nArchitectures: $(dpkg --print-architecture)\nSigned-By: \/etc\/apt\/keyrings\/docker.asc\nEOF\nsudo apt-get update\nsudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\nsudo systemctl enable --now docker<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the daemon, Compose plugin, and a disposable test container:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl is-active docker\nsudo docker version --format 'Client {{.Client.Version}} \/ Server {{.Server.Version}}'\nsudo docker compose version\nsudo docker run --rm hello-world<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output is similar to this; the version numbers will change:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\nClient 29.x.y \/ Server 29.x.y\nDocker Compose version v2.x.y\nHello from Docker!\nHello from Docker!<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keep using <code>sudo docker<\/code> in this guide. Adding a user to the <code>docker<\/code> group removes the password prompt but grants that account root-equivalent control of the server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Generate Docmost\u2019s protected settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: Docmost needs a persistent application secret, and PostgreSQL needs the same database password in both its container settings and the application connection URL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Generate hex values so the database password is safe inside a connection string, then create the deployment directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl rand -hex 32\nopenssl rand -hex 24\nsudo install -d -m 0755 \/opt\/docmost\nsudo nano \/opt\/docmost\/.env<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create <code>\/opt\/docmost\/.env<\/code> in the editor:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>APP_URL=https:\/\/YOUR_DOMAIN\nAPP_SECRET=REPLACE_WITH_64_HEX_CHARACTERS\nDB_PASSWORD=REPLACE_WITH_48_HEX_CHARACTERS<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>YOUR_DOMAIN<\/code> with the hostname users will open. Put the first command\u2019s 64-character result in <code>APP_SECRET<\/code> and the second command\u2019s 48-character result in <code>DB_PASSWORD<\/code>; do not leave the uppercase examples in the file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file and make the credentials readable only by root:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod 600 \/opt\/docmost\/.env\nsudo chown root:root \/opt\/docmost\/.env<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The official <a href=\"https:\/\/docmost.com\/docs\/installation\" target=\"_blank\" rel=\"noopener\">Docmost installation documentation<\/a> requires an application secret of at least 32 characters and uses PostgreSQL, Redis, and the <code>\/api\/health<\/code> endpoint shown later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Add Caddy and the Compose definition<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: Caddy handles automatic HTTPS and WebSocket proxying, while named Docker volumes keep the wiki data when containers are recreated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create <code>\/opt\/docmost\/Caddyfile<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/opt\/docmost\/Caddyfile<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Paste this configuration and replace <code>YOUR_DOMAIN<\/code> with the same hostname used in <code>.env<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>YOUR_DOMAIN {\n    reverse_proxy docmost:3000\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now create the Compose file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/opt\/docmost\/docker-compose.yml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Paste this definition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  caddy:\n    image: caddy:2\n    ports:\n      - \"80:80\"\n      - \"443:443\"\n    volumes:\n      - .\/Caddyfile:\/etc\/caddy\/Caddyfile:ro\n      - caddy_data:\/data\n      - caddy_config:\/config\n    depends_on:\n      - docmost\n    restart: unless-stopped\n\n  docmost:\n    image: docmost\/docmost:latest\n    depends_on:\n      - db\n      - redis\n    environment:\n      APP_URL: \"${APP_URL}\"\n      APP_SECRET: \"${APP_SECRET}\"\n      DATABASE_URL: \"postgresql:\/\/docmost:${DB_PASSWORD}@db:5432\/docmost\"\n      REDIS_URL: \"redis:\/\/redis:6379\"\n    ports:\n      - \"127.0.0.1:3000:3000\"\n    restart: unless-stopped\n    volumes:\n      - docmost:\/app\/data\/storage\n\n  db:\n    image: postgres:18\n    environment:\n      POSTGRES_DB: docmost\n      POSTGRES_USER: docmost\n      POSTGRES_PASSWORD: \"${DB_PASSWORD}\"\n    restart: unless-stopped\n    volumes:\n      - db_data:\/var\/lib\/postgresql\n\n  redis:\n    image: redis:8\n    command: [\"redis-server\", \"--appendonly\", \"yes\", \"--maxmemory-policy\", \"noeviction\"]\n    restart: unless-stopped\n    volumes:\n      - redis_data:\/data\n\nvolumes:\n  docmost:\n  db_data:\n  redis_data:\n  caddy_data:\n  caddy_config:<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>127.0.0.1<\/code> binding keeps port 3000 off the public network; only Caddy can reach the application through Docker\u2019s private network. The named volumes preserve pages, uploads, PostgreSQL records, Redis persistence, and Caddy\u2019s certificate state.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Allow web traffic and start Docmost<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: UFW should allow SSH and Caddy\u2019s web ports while keeping the application, database, and cache inaccessible from the internet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Install UFW, preserve SSH access, then open only HTTP and HTTPS:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install -y ufw\nsudo ufw default deny incoming\nsudo ufw default allow outgoing\nsudo ufw allow OpenSSH\nsudo ufw allow 80\/tcp\nsudo ufw allow 443\/tcp\nsudo ufw --force enable\nsudo ufw status verbose<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The status should be active and include the three required rules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Status: active\n80\/tcp                   ALLOW       Anywhere\n443\/tcp                  ALLOW       Anywhere\nOpenSSH                  ALLOW       Anywhere<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If SSH uses a custom port, allow that port before enabling UFW instead of using <code>OpenSSH<\/code>. You can also generate a matching ruleset with VPSLake\u2019s <a href=\"https:\/\/vpslake.com\/ufw-firewall-generator\">UFW firewall generator<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Docker warns that published container ports can bypass some UFW filtering paths. This layout publishes only Caddy\u2019s ports and binds Docmost to loopback, so do not change the application mapping to <code>3000:3000<\/code> unless you intentionally want a separate firewall design.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Validate the rendered configuration, download the images, and launch the services:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/docmost\nsudo docker compose config --quiet\nsudo docker compose pull\nsudo docker compose up -d\nsudo docker compose ps<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first image pull may take several minutes. A healthy result has four services in an <code>Up<\/code> state:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>NAME                 SERVICE   STATUS    PORTS\ndocmost-caddy-1      caddy     Up        0.0.0.0:80-&gt;80\/tcp, 0.0.0.0:443-&gt;443\/tcp\ndocmost-docmost-1    docmost   Up        127.0.0.1:3000-&gt;3000\/tcp\ndocmost-db-1         db        Up\ndocmost-redis-1      redis     Up<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Compose may select different container names. A service that repeatedly restarts needs its logs checked before you open the site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify the Docmost installation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: An HTTPS health request checks DNS, the certificate, Caddy\u2019s proxy route, and Docmost\u2019s HTTP listener in one pass.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -fsS -o \/dev\/null -w 'HTTP %{http_code}\\n' https:\/\/YOUR_DOMAIN\/api\/health<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP 200<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open <code>https:\/\/YOUR_DOMAIN<\/code> 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.<\/p>\n\n\n\n<aside class=\"vl-element vl-cta-banner\" aria-label=\"Host Docmost securely\">\n\t<div class=\"vl-cta-banner__content\">\n\t\t<p class=\"vl-cta-banner__eyebrow\">Ubuntu 24.04 VPS<\/p>\n\t\t<h3 class=\"vl-cta-banner__title\">Host Docmost securely<\/h3>\n\t\t<p class=\"vl-cta-banner__text\">Deploy your Docker-based documentation workspace on a root-access Ubuntu VPS with public IPv4.<\/p>\n\t<\/div>\n\t<a class=\"vl-cta-banner__button\" href=\"\/buy-vps\" aria-label=\"View Linux VPS plans\">View Linux VPS plans<\/a>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><code>permission denied while trying to connect to the Docker daemon socket<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The current account cannot access Docker\u2019s Unix socket. Run the commands as shown with <code>sudo<\/code>; if the daemon itself is stopped, start it and check its state:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable --now docker\nsudo systemctl is-active docker<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Caddy cannot obtain a certificate<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This usually means <code>YOUR_DOMAIN<\/code> does not resolve to <code>SERVER_IP<\/code>, or a provider firewall blocks port 80 or 443. Check the DNS record, allow both ports in the VPS control panel, and inspect Caddy\u2019s log:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/docmost\nsudo docker compose logs --tail=80 caddy<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">The browser shows <code>502 Bad Gateway<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/docmost\nsudo docker compose ps\nsudo docker compose logs --tail=100 docmost db redis\nsudo docker compose up -d<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><code>Bind for 0.0.0.0:80 failed: port is already allocated<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Another web server is already using port 80 or 443. Identify the process with <code>sudo ss -ltnp<\/code>, then stop or reconfigure that service, or place Caddy behind the existing reverse proxy and remove the conflicting host port mapping.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Can I install Docmost without a domain name?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can test the application locally, but this guide uses Caddy\u2019s 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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why is port 3000 not open in the firewall?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Docmost listens on loopback and Caddy forwards public HTTPS traffic to it over Docker\u2019s private network. Keeping 3000 private avoids exposing the application without the TLS and proxy layer.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I update Docmost later?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Back up your Docker volumes first, then pull current images and recreate changed services from <code>\/opt\/docmost<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/docmost\nsudo docker compose pull\nsudo docker compose up -d<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Where does Docmost store its data?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pages and uploaded files are in the <code>docmost<\/code> volume, PostgreSQL uses <code>db_data<\/code>, Redis uses <code>redis_data<\/code>, and Caddy stores certificates in <code>caddy_data<\/code>. Back up these volumes or an equivalent export before upgrades and server maintenance.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Can I install Docmost without a domain name?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"You can test the application locally, but this guide uses Caddy\u2019s 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.\"}}, {\"@type\": \"Question\", \"name\": \"Why is port 3000 not open in the firewall?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Docmost listens on loopback and Caddy forwards public HTTPS traffic to it over Docker\u2019s private network. Keeping 3000 private avoids exposing the application without the TLS and proxy layer.\"}}, {\"@type\": \"Question\", \"name\": \"How do I update Docmost later?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Back up your Docker volumes first, then pull current images and recreate changed services from `\/opt\/docmost`:\"}}, {\"@type\": \"Question\", \"name\": \"Where does Docmost store its data?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"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.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Install Docmost using Docker on Ubuntu 24.04 with PostgreSQL, Redis, Caddy HTTPS, UFW rules, health checks, and common fixes for a private wiki in minutes.","protected":false},"author":1,"featured_media":1122,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[5,9],"tags":[118,138,139,102],"class_list":["post-1121","post","type-post","status-publish","format-standard","has-post-thumbnail","category-guides","category-vps-hosting","tag-docker","tag-docmost","tag-self-hosting","tag-ubuntu-24-04","cs-entry"],"_links":{"self":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/comments?post=1121"}],"version-history":[{"count":1,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1121\/revisions"}],"predecessor-version":[{"id":4110,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1121\/revisions\/4110"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media\/1122"}],"wp:attachment":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media?parent=1121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/categories?post=1121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/tags?post=1121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}