安装Ghost with Nginx in Docker

创建个docker-compose文件
vim docker-compose.yml
内容

version: "2"

services:
  ghost:
    image: ghost:alpine
    container_name: ghost
    volumes:
     - ./blog:/var/lib/ghost
    networks:
     - nginx-proxy
    environment:
     - VIRTUAL_HOST=kdaye.com,www.kdaye.com
     - LETSENCRYPT_HOST=kdaye.com,www.kdaye.com
     - LETSENCRYPT_EMAIL=K@kdaye.com

networks:
  nginx-proxy:
    external:
     name: "nginx-proxy"

运行
docker-compose up -d

说明

# 这是将ghost里需要保存的数据,保存在当前目录的blog里
volumes:
     - ./blog:/var/lib/ghost

# 配置这个环境是告诉Nginx,我需要这个域名访问到ghost container
# Nginx Docker的安装请看 http://kdaye.com/install-nginx-in-docker/
# 假如你不需要Nginx 就不用看这个.也不需要添加这行.
    environment:
     - VIRTUAL_HOST=kdaye.com,www.kdaye.com
     - LETSENCRYPT_HOST=kdaye.com,www.kdaye.com
     - LETSENCRYPT_EMAIL=K@kdaye.com 

# 让这个Container连接Nginx-proxy
    networks:
     - nginx-proxy
networks:
  nginx-proxy:
    external:
     name: "nginx-proxy"
Show Comments