DOKPLOY-GUIDE 7 min read fordnox

Deploy Ghost with Dokploy: Docker Compose Setup Guide

Step-by-step guide to deploying Ghost CMS on your VPS using Dokploy and Docker Compose. Includes MySQL database, content storage, and SSL configuration.


Deploy Ghost with Dokploy

Dokploy is an open-source server management platform that simplifies deploying Docker Compose applications on your VPS. It handles reverse proxy configuration, SSL certificates, and deployment management — making it straightforward to run Ghost as a production-ready blogging platform.

This guide walks you through deploying Ghost with a MySQL database backend, persistent content storage, and automatic HTTPS. Ghost requires MySQL for production use.

Prerequisites

Docker Compose Configuration

Create a new Compose project in Dokploy and paste the following configuration:

version: "3.8"

services:
  ghost:
    image: ghost:5-alpine
    restart: unless-stopped
    ports:
      - "2368:2368"
    environment:
      - url=https://${GHOST_DOMAIN}
      - NODE_ENV=production
      - database__client=mysql
      - database__connection__host=ghost-db
      - database__connection__port=3306
      - database__connection__user=ghost
      - database__connection__password=${GHOST_DB_PASSWORD}
      - database__connection__database=ghost
    volumes:
      - ../files/ghost-content:/var/lib/ghost/content
    depends_on:
      ghost-db:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://localhost:2368/ghost/api/admin/site/ || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3

  ghost-db:
    image: mysql:8.0
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=${GHOST_DB_ROOT_PASSWORD}
      - MYSQL_DATABASE=ghost
      - MYSQL_USER=ghost
      - MYSQL_PASSWORD=${GHOST_DB_PASSWORD}
    volumes:
      - ../files/ghost-db-data:/var/lib/mysql
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -p${GHOST_DB_ROOT_PASSWORD}"]
      interval: 10s
      timeout: 5s
      retries: 5

Note: Ghost requires MySQL 8.0 for production use. The SQLite mode is only suitable for development. The url environment variable must match your public domain with HTTPS for proper link generation.

Environment Variables

Set these in Dokploy's Environment tab for your compose project:

Variable Purpose Example
GHOST_DOMAIN Your Ghost blog domain blog.yourdomain.com
GHOST_DB_PASSWORD MySQL database password for Ghost user a-strong-random-password
GHOST_DB_ROOT_PASSWORD MySQL root password another-strong-password

In Dokploy, environment variables are set via the Environment editor in the project settings. Do not create a .env file manually — Dokploy manages this for you. Ghost uses a double-underscore naming convention for nested config (e.g., database__connection__host).

Volumes & Data Persistence

This setup uses Dokploy's ../files convention for bind-mounted volumes:

The ../files path is relative to the compose file inside Dokploy's project directory. This ensures your data persists across redeployments. Avoid using absolute paths (e.g., /opt/ghost) because Dokploy may clean them during redeployment.

If you need S3 backup support, consider using named Docker volumes instead. Named volumes can be backed up with Dokploy's built-in backup features.

Domain & SSL Setup

  1. In your Dokploy project, navigate to the Domains tab
  2. Click Add Domain and enter your domain (e.g., blog.yourdomain.com)
  3. Set the container port to 2368
  4. Enable HTTPS — Dokploy automatically provisions a Let's Encrypt SSL certificate
  5. Save and wait for the certificate to be issued (usually under a minute)

Dokploy's built-in Traefik reverse proxy handles TLS termination and routes traffic to your Ghost container. The url environment variable must use https:// to match.

Verifying the Deployment

  1. In Dokploy, go to your project's Deployments tab and click Deploy
  2. Watch the build logs — you should see both ghost and ghost-db containers start
  3. Check the Logs tab for the ghost service. Look for: Ghost booted in followed by a time
  4. Open https://blog.yourdomain.com in your browser — you should see the Ghost default homepage
  5. Navigate to https://blog.yourdomain.com/ghost/ to access the admin panel and create your account

Troubleshooting

Ghost shows "502 Bad Gateway" initially Ghost takes 30–60 seconds to initialize the database on first boot. Wait for the health check to pass, then refresh. Check the ghost service logs for database migration progress.

Images and uploads not persisting Ensure the ../files/ghost-content volume is correctly mapped to /var/lib/ghost/content. Ghost stores all uploaded images, themes, and media in this directory. Without the volume, content is lost on container restart.

"url" mismatch causing redirect loops The url environment variable must exactly match your domain with the https:// protocol. If it's set to http:// while Dokploy serves HTTPS, Ghost will create redirect loops. Always set url=https://your-domain.com.

SSL certificate not issuing Ensure your domain's DNS A record points to your server's IP and has propagated. Dokploy uses Let's Encrypt HTTP-01 challenges, so port 80 must be accessible. Check Traefik logs in Dokploy for certificate-related errors.


Learn more about Ghost in our complete overview.

Need a VPS? Hostinger VPS starts at $4.99/mo — perfect for running Ghost.


For more on Docker Compose deployments in Dokploy, see the Dokploy Docker Compose documentation.

App data sourced from selfh.st open-source directory.

~/self-hosted-app/ghost/dokploy/get-started

Ready to get started?

Get the best VPS hosting deal today. Hostinger offers 4GB RAM VPS starting at just $4.99/mo.

Get Hostinger VPS — $4.99/mo

// up to 75% off + free domain included

// related topics

ghost dokploy docker compose self-hosted blogging platform ghost deployment

fordnox

Expert VPS reviews and hosting guides. We test every provider we recommend.

// last updated: February 12, 2026. Disclosure: This article may contain affiliate links.