Introduction
Hello folks! It is great to have helpful and skillful members like you. I am stuck after reproducing the step-by-step instructions from various blogs to create a whole suite of Docker-powered apps from a small hosted VPS. Mainly to create a blog with ghost, nginx and ssl.
Problem
While executing docker-compose.yml the nginx container stops:
- nginx-gen | 2018/04/09 07:52:03 Generated '/etc/nginx/conf.d/default.conf' from 5 containers
- nginx-gen | 2018/04/09 07:52:03 Sending container 'nginx' signal '1'
- nginx-gen | 2018/04/09 07:52:03 Watching docker events
- nginx | nginx-gen | 2018/04/09 07:52:03 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''
- nginx-gen | 2018/04/09 07:52:03 Received event die for container 789c0544cf96
- nginx-gen | 2018/04/09 07:52:03 Debounce minTimer fired
- nginx exited with code 2
Setup
- GCP CE g1-small (1 vCPU, 1,7 GB Memory)
- Ubuntu 16.04.4 LTS
- Docker version 18.03.0-ce, build 0520e24
- docker-compose version 1.20.1, build 5d8c71b
Docker Images
- jwilder/nginx-proxy
- jwilder/docker-gen
- jrcs/letsencrypt-nginx-proxy-companion
Files #
- nginx.tmpl (Source: https://github.com/jwilder/nginx-proxy/blob/master/nginx.tmpl)
- docker-compose.yml
Notes
- All files are in the same folder.
- Used already docker network create nginx-proxy
docker-compose.yml
version: '2'
services:
nginx:
image: jwilder/nginx-proxy
container_name: nginx
ports:
- '80:80'
- '443:443'
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /etc/nginx/conf.d
- /etc/nginx/vhost.d # to update vhost configuration
- /usr/share/nginx/html # to write challenge files
- "../../../volumes/proxy/certs:/etc/nginx/certs:ro"
networks:
- default
nginx-gen:
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "./:/etc/docker-gen/templates/:ro"
volumes_from:
- nginx
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
ssl-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: ssl-companion
volumes_from:
- nginx
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "../../../volumes/proxy/certs:/etc/nginx/certs:rw"
mariadb:
image: 'bitnami/mariadb:latest'
volumes:
- '/mariadb_data:/bitnami:z'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=<USER_NAME> # change <USER_NAME>
- MARIADB_DATABASE=<DB_NAME> # change <DB_NAME>
blog:
image: 'bitnami/ghost:latest'
expose:
- '2368'
depends_on:
- mariadb
environment:
- VIRTUAL_HOST=<YOUR_VR_HOST> # change <YOUR_VR_HOST>
- LETSENCRYPT_HOST=<YOUR_LC_HOST> # change <YOUR_LC_HOST>
- LETSENCRYPT_EMAIL=<YOUR_EMAIL> # change <YOUR_EMAIL>
- GHOST_DATABASE_USER=<USER_NAME> # change <USER_NAME>
- GHOST_DATABASE_NAME=<DB_NAME> # change <DB_NAME>
- GHOST_HOST=localhost
- MARIADB_HOST=mariadb
- MARIADB_PORT_NUMBER=3306
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- '/ghost_data:/bitnami:z'
restart: unless-stopped
networks:
- default
networks:
default:
external:
name: nginx-proxy