Ghost on Docker

Self-host Ghost with Docker Compose: Ghost, MySQL and Caddy with automatic HTTPS, installed and kept up to date by one launcher.

This is a beta. For a supported setup today, use the main branch of ghost-docker or Ghost-CLI.

Requirements

A production site

Ports 80 and 443 must be free. Make an empty directory for the site and run, from inside it:

curl -fsSL https://docker.ghost.org/install.sh | bash -s -- install --domain example.com --email you@example.com

Then point the domain's DNS at this host. Caddy obtains a certificate once it does, and ./ghost-docker check reports it.

A local site

For themes, and for trying Ghost, on 127.0.0.1:

mkdir ~/my-site && cd ~/my-site
curl -fsSL https://docker.ghost.org/install.sh | bash -s -- install --local

Moving a Ghost-CLI site

A local Ghost-CLI site (one made with ghost install local) moves to Docker with its posts, members, staff accounts, settings, themes, images and configuration. You need Ghost-CLI 1.34.0 or later, and Ghost 6.61.0 or later in the site: the import runs the exact version the site did, and 6.61.0 is the first with a Docker image the import can use. Older sites are refused, so update first.

Update Ghost-CLI and the site, and check the site still works. Then stop it, export it, and install from the export in a new directory beside it, on the port it used:

npm install -g ghost-cli@latest
cd ~/sites/my-blog
ghost update
ghost stop
ghost migrate-export --output ../my-blog-bundle
mkdir ../my-blog-docker && cd ../my-blog-docker
curl -fsSL https://docker.ghost.org/install.sh | bash -s -- install --import ../my-blog-bundle --port 2368

Production Ghost-CLI sites can't be imported yet. That is coming in a later beta.

Afterwards

Installation writes a launcher into the site directory. Every later command runs from there:

./ghost-docker check     # diagnose the site
./ghost-docker self-update  # a newer stack release; Ghost is unchanged
docker compose logs -f ghost

Problems and feedback

This is a beta, and reports of what goes wrong, or could be better, shape it. Open an issue with what happened and the output of ./ghost-docker version and ./ghost-docker doctor; the form asks for the rest. Before you paste output or logs, remove passwords, tokens, and any domains or directory paths you do not want to share. Never paste .env or ghost.env.

More