How to Install Ghost with Docker on a VPS
A practical Ghost Docker VPS install guide covering DNS, Docker Compose, Caddy, MySQL, SMTP, backups, updates, and provider fit.
Disclosure: WealthLab.life may earn a commission when you register through some links on this page, at no additional cost to you.
Ghost can run cleanly on a VPS with Docker, but a production install needs more than a copied Compose file. You need DNS, enough RAM, Docker installed from a trusted source, a reverse proxy with HTTPS, MySQL storage, SMTP, backups, and a safe update routine. This guide gives a practical deployment path without pretending every server or provider is identical.
Quick answer
For a small public Ghost site, use a Linux VPS with at least 2 GB RAM, a domain pointed at the server, Docker Engine and the Compose plugin, Ghost's Docker tooling or an equivalent Compose stack, MySQL, Caddy or another reverse proxy, and tested backups. Use 1 GB only for disposable testing; use 4 GB or more if the server also runs other Docker apps, heavy image uploads, analytics, monitoring, or backup jobs.
Ghost's official Docker install guide describes the Docker tooling as a preview for Ghost 6 and lists a Linux server, Docker 20.10.13 or higher, a domain A record, and SMTP email service among the prerequisites. Treat that as the baseline, then add your own backup and monitoring plan before relying on the site.
Before you start
- Domain: create an A record for the root domain or subdomain you will use.
- Server access: use SSH keys, not a password-only workflow.
- VPS size: start with 2 GB RAM for a small public Ghost site; use more for multiple services or higher traffic.
- Email: prepare SMTP details if you need staff invites, transactional messages, or newsletters.
- Backups: decide where the MySQL database, images, themes, and Ghost export will be copied.
- Firewall: expose only SSH plus HTTP/HTTPS unless you have a specific need.
Disclosure: WealthLab.life may earn a commission when you register through some links in this section, at no additional cost to you.
1. Create the VPS
Choose a region close to your readers and leave enough headroom for Ghost, MySQL, Caddy, Docker, logs, updates, and backups. The cheapest VPS can be fine for learning, but production failures often happen during upgrades, image processing, or backup jobs rather than during normal idle traffic.
If you are choosing between providers, DigitalOcean is a good fit when you want a straightforward Droplet workflow and beginner-friendly docs. Vultr is worth comparing when location choice or instance-family variety matters. Verify current plan details and backup pricing on the provider site before creating the server.
2. Prepare DNS and firewall rules
Point your domain to the VPS IP before requesting certificates. Then keep the exposed-port set small:
# Typical public ports
22/tcp # SSH, ideally restricted if possible
80/tcp # HTTP, used for redirect and certificate issuance
443/tcp # HTTPS
Do not expose MySQL, Redis, Ghost's internal port, or dashboard tools directly to the internet. Put application containers on an internal Docker network and route public traffic through the reverse proxy.
3. Install Docker safely
Use Docker's official installation documentation for your distribution. For Ubuntu servers, Docker documents the apt-repository method and also warns that Docker's networking can interact with firewalls in surprising ways, including bypassing some ufw or firewalld expectations when ports are published. Review the firewall notes before assuming a host firewall protects every container port.
Avoid random curl | bash commands from third-party blogs unless you understand and trust the source. For production, prefer the official repository instructions and keep Docker updated through your normal package-management process.
4. Use Ghost's Docker tooling or a clear Compose layout
Ghost's Docker guide uses a Compose-based setup with Ghost, Caddy, MySQL, and optional services such as ActivityPub and Tinybird analytics. The official flow is roughly:
git clone https://github.com/TryGhost/ghost-docker.git /opt/ghost
cd /opt/ghost
cp .env.example .env
cp caddy/Caddyfile.example caddy/Caddyfile
Edit .env before starting anything. At minimum, set the domain, database passwords, and mail settings. Keep .env out of git because it contains secrets.
5. Configure the important environment values
- DOMAIN: the public canonical host, such as
example.com. - ADMIN_DOMAIN: optional separate admin hostname if you want one.
- DATABASE_ROOT_PASSWORD and DATABASE_PASSWORD: generate strong random values and store them in a password manager.
- SMTP/mail settings: required for reliable transactional email.
- COMPOSE_PROFILES: only enable optional analytics or ActivityPub services when you are ready to operate them.
If your deployment sits behind another reverse proxy or Cloudflare tunnel, make sure Ghost still sees the correct public HTTPS host. Incorrect forwarded-proto or host headers can cause redirect loops, wrong canonical URLs, or mixed-content problems.
6. Start Ghost and complete setup
After configuration, pull images and start the stack:
docker compose pull
docker compose up -d
docker compose ps
Then visit https://your-domain/ghost/ and complete the owner account setup. Check the public homepage, admin route, sitemap, and robots file before publishing important content.
7. Verify the site before publishing
/returns 200 and has the expected title./ghost/loads the admin sign-in or setup screen./robots.txtreturns 200 and includes the sitemap URL./sitemap.xmlreturns 200 and links to post/page sitemaps.- Canonical URLs use the public HTTPS domain.
- HTTP redirects to HTTPS if public HTTP exists.
- Hidden files such as
/.envand/.git/configare not exposed.
8. Back up Ghost before you need recovery
A useful Ghost backup normally needs more than one file. Plan for:
- MySQL dumps or provider-level database backups.
content/imagesfor uploaded media.content/themesif you customize the theme.- Ghost exports from Admin as an extra portable copy.
- Off-server storage so a full VPS loss is recoverable.
Do at least one restore rehearsal. A backup that has never been restored is only a hope.
9. Update Ghost without surprising yourself
Before updating, read Ghost release notes, export content, back up the database and content directory, then update during a low-traffic window:
docker compose pull
docker compose up -d
docker compose logs --tail=100 ghost
Watch logs after the restart and verify the same public URLs again. Do not rely only on docker compose ps; a container can be up while canonical URLs, mail, or reverse-proxy behavior is broken.
Before updates or migrations, use the Ghost Docker backup and restore guide to build and test a complete recovery set.
Common mistakes
- Starting too small: 1 GB may pass a first smoke test but struggle during updates, backups, or image work.
- Skipping SMTP: Ghost can serve pages without SMTP, but owner/account workflows and email features may fail.
- Committing secrets: never commit
.env, database dumps, API keys, or live content directories. - Exposing internal ports: publish the reverse proxy, not MySQL or Ghost's internal app port.
- No restore test: snapshots and dumps matter only if you know how to use them under pressure.
Choosing a host first? Read the Best VPS for Ghost Hosting guide for sizing and provider-fit decisions.
Using DigitalOcean? Follow the DigitalOcean-specific Ghost Docker deployment guide for Droplet, Cloud Firewall, DNS, and recovery details.
Using Vultr? Follow the Vultr-specific Ghost Docker deployment guide for Cloud Compute, Firewall, DNS, and recovery details.
Recommended VPS path
If you want the simplest tutorial-following path, start with a 2 GB Linux VPS, Docker Compose, Ghost's Docker tooling, Caddy, MySQL, SMTP, and provider snapshots plus your own off-server backup. DigitalOcean and Vultr can both work; choose by region, operational comfort, support expectations, and total cost after backups.
Related sizing and provider guides:
- Ghost VPS Sizing: How Much RAM Do You Need?
- DigitalOcean vs Vultr: Which VPS Should You Choose?
- Docker VPS Launch Checklist Before You Go Public
- DigitalOcean Droplet Setup Checklist for Docker Apps
FAQ
Can Ghost run on a 1 GB VPS?
Yes for learning or a disposable test, but 2 GB RAM is a safer baseline for a public Ghost site with MySQL, Caddy, Docker, backups, and routine updates on the same server.
Do I need Docker to self-host Ghost?
No. Ghost has other install paths, but Docker Compose can make the stack easier to reproduce when you are comfortable operating containers, volumes, and reverse proxies.
Should MySQL run on the same VPS?
For a small site, yes, it can. For a busier or revenue-critical publication, a separate managed database or a more deliberate database-backup strategy may be worth the extra cost and complexity.
Which provider is better for Ghost, DigitalOcean or Vultr?
Neither is universally better. DigitalOcean is often easier for a straightforward tutorial path; Vultr is useful when you want more region or instance-family options. Compare current plans, backup cost, bandwidth, and your preferred operating workflow.
Not sure a self-managed server fits? Compare the operational trade-offs in the VPS vs shared hosting guide before deploying.
Sources checked
Last updated: 2026-08-29