WIKI: Installing Ghost in Docker


#1

Continuing the discussion from Suggestions for Content?:

:warning: This guide is not complete, I’m still working upon this as the instructions need to be modified to run in production environment. This guide needs a lot of Improvement.

Want to Run Ghost inside Docker?

Let’s get started:

We’re using the following image:
https://hub.docker.com/_/ghost/

However, the image needs a custom docker-file for docker-compose to work in Production environment or else You’d end up with a fresh install every time you try to upgrade it.

:warning: However, Please bear in mind that You can not use the Ghost-CLI tool because … reasons.

Use this Dockerfile:

# by default, the Ghost image will use SQLite (and thus requires no separate database container)
# we have used MySQL here merely for demonstration purposes (especially environment-variable-based configuration)

version: '3.1'

services:

  ghost:
    image: ghost:1-alpine
    restart: always
    ports:
      - 8080:2368
    environment:
      # see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example

This configuration file is not ready for production use. I still need to mount volumes to a Persistent storage outside the docker container.


#2

What I Plan to do with this Image:

Use MySQL Alpine Image.
Persistent Storage for User Data (Uploads/Themes etc.)
Persistent MySQL Data
Others (May come up in future)


#3

Other Sources:
I found these Ghost Docker files, Will see if any of these are useful.