Ghost一步到位

需要安装COMPOSE
https://kdaye.com/install-docker-and-docker-compose/

vim docker-compose.yml
黏贴如下

version: "2"

services:
   nginx:
     restart: unless-stopped
     image: nginx:alpine
     container_name: nginx
     ports:
      - "80:80"
      - "443:443"
     volumes:
      - "./volumes/conf.d:/etc/nginx/conf.d:ro"
      - "./volumes/vhost.d:/etc/nginx/vhost.d:ro"
      - "./volumes/certs:/etc/nginx/certs:ro"
      - "/usr/share/nginx/html"
     networks:
      - nginx-proxy

   docker-gen:
     restart: unless-stopped
     image: jwilder/docker-gen:0.7.3
     container_name: docker-gen
     depends_on:
      - nginx
     volumes_from:
      - nginx
     volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "./volumes/templates:/etc/docker-gen/templates:ro"
      - "./volumes/conf.d:/etc/nginx/conf.d:rw"
     networks:
      - nginx-proxy
     entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf

   letsencrypt:
     restart: unless-stopped
     image: jrcs/letsencrypt-nginx-proxy-companion
     container_name: letsencrypt
     depends_on:
      - nginx
      - docker-gen
     volumes_from:
      - nginx
     volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./volumes/vhost.d:/etc/nginx/vhost.d:rw"
      - "./volumes/certs:/etc/nginx/certs:rw"
     environment:
      - "NGINX_DOCKER_GEN_CONTAINER=docker-gen"
   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

Show Comments