Docker: Ghost Blog

Quick & Dirty snippet to start own ghost blog.

Docker: Ghost Blog
Photo by Venti Views / Unsplash

Quick & Dirty snippet to start own ghost blog.

Prequisites:

  • installed Linux host with docker-compose
  • /services/ghost created, copy docker-compose.yaml to this.
  • create .env in same folder and add following values:

.env

URL=
database__connection__user=
database__connection__password=
database__connection__database=
MYSQL_ROOT_PASSWORD=
MYSQL_USER=
MYSQL_PASSWORD=
MYSQL_DATABASE=
WEBSITE_PORT=


docker-compose.yml

version: '3.3'
services:
  ghost:
    image: ghost:latest
    container_name: ghost_site
    restart: always
    depends_on:
      - db
    ports:
      - ${WEBSITE_PORT}:2368
    environment:
      url: ${URL}
      database__client: mysql
      database__connection__host: db
      database__connection__user: ${database__connection__user}
      database__connection__password: ${database__connection__password}
      database__connection__database: ${database__connection__database}
    volumes:
      - /services/ghost/content:/var/lib/ghost/content

  db:
    image: mariadb:latest
    container_name: ghost_db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
    volumes:
      - /services/ghost/mysql:/var/lib/mysql


docker_container_template
docker_container_template

After you've created both files you can start the container with

docker-compose up -d

Note:
There is no SSL added, you could run it behind a reverse proxy e.g. with Caddy