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
- Docker Engine 25.0 or later with the Compose plugin 2.24 or later, and bash.
- Linux for a production site. Local sites also run on Docker Desktop, OrbStack and WSL2 on Windows.
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
- The Docker site runs the exact Ghost version the source did, at the same
http://localhost:2368. Use the source's port:server.portin itsconfig.development.json. - Staff sign in with their existing passwords.
- If the import fails, it removes what it created, and
ghost startin the source brings it back as it was. Neither the source nor the export is changed. - The export holds the site's configuration, secrets included. Remove it once you no longer need it.
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
- Installation guide: every option, releases and channels, and updates.
- Importing a Ghost-CLI site: what an import carries over, what it refuses, and what to expect.
- Configuration.
- install.sh: the launcher itself. Read it before you run it.