docker: traefix example docker-compose.yaml

A docker-compose.yaml example for traefix

docker: traefix example docker-compose.yaml
Photo by Archer Hadland / Unsplash

Before you run it make sure that you have the network created.

sudo docker network create proxy

Make sure you create a local directory where you docker-compose sits 'content' to match the persistence volume ./content

./content:/var/lib/ghost/content
version: '3'

services:
  ghost:
    image: ghost:latest
    container_name: ghost
    volumes:
      - ./content:/var/lib/ghost/content
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.blog.rule=Host(`www.somewhere.com`)"
      - "traefik.http.routers.blog.entrypoints=web"
      - "traefik.port=80"
      - "traefik.port=443"
    environment:
      - NODE_ENV=development
      - database_client=mysql
      - database_debug=false
      - database_connection_host=127.0.0.1
      - database_connection_user=root
      - database_connection_passwrd=password
      - database_connection_database=ghost
    networks:
      - proxy
    restart: always
    

networks:
  proxy:
    external: true

To activate it:

# diagnostic mode
sudo docker-compose up   
# detached mode
sudo docker-compose up -d
Linux Rocks Every Day