/ Docker

How to deploy Ghost with Docker

Two things I did for the production deployment of Ghost:

  1. Use an environment directive to point the server to the correct URL, either in the run command, or as I did, in the docker-compose file.
  2. Create a Docker volume for Ghost's content folder. Again, I did this in my docker-compose file. The volume will have persistent state whether or not the container is running because it lives in your filesystem, not in the container.

Here's the docker-compose file I'm currently using:

version: '3'
services:

  ghost:
    image: ghost:1-alpine
    ports:
      - "80:2368"
    volumes:
      - /opt/ghost/content:/var/lib/ghost/content
    restart: always
    environment:
      # see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
      url: "https://jefflazerus.com"

networks:
  default:
    external:
      name: mean_default

Luca Bravo