Running Ghost 5 in Docker

Here's a docker-compose.yaml file for running Ghost v5 in Docker.

A few things to keep in mind:

  • Update the root password to your liking
  • You will want to run this under a reverse proxy (NGINX, Traefik, etc)
  • DB initialization takes about 10 minutes
version: '3.1'

services:
  ghost:
    image: ghost:5-alpine
    restart: always
    ports:
      - 8080:2368
    environment:
      # see https://ghost.org/docs/config/#configuration-options
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: [ROOTPASS]
      database__connection__database: ghost
      url: https://your.url.com
    volumes:
      - ./ghost_content:/var/lib/ghost/content
    networks:
      - ghost_private          
  db:
    image: mysql:8
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: [ROOTPASS]
    volumes:
      - ./mysql_data:/var/lib/mysql
    networks:
      - ghost_private
networks:
  ghost_private: