Setup Docker containers with jwilder nginx proxy
Simple docker compose to expose a self hosted docker service with jwilder nginx proxy and the let’s encrypt companion.
The NodeJS application is running on port 8080.
Configuration
services:
www:
build:
context: .
container_name: webuxlab-blog
volumes:
- ${PWD}/public:/usr/app/node/build/public:ro
- ${PWD}/db:/usr/app/node/build/db:ro
ports:
- 8080:8080
environment:
- EXPRESS_PORT=8080
- EXPRESS_HOSTNAME=0.0.0.0
- VIRTUAL_HOST=beta.webuxlab.com
- VIRTUAL_PORT=8080
- LETSENCRYPT_HOST=beta.webuxlab.com
restart: unless-stopped
network_mode: bridge
nginx-proxy:
image: nginxproxy/nginx-proxy:1.5-alpine
container_name: nginx-proxy
network_mode: bridge
ports:
- '80:80'
- '443:443'
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
acme-companion:
image: nginxproxy/acme-companion
container_name: nginx-proxy-acme
environment:
- DEFAULT_EMAIL=tommy@studiowebux.com
volumes_from:
- nginx-proxy
volumes:
- certs:/etc/nginx/certs:rw
- acme:/etc/acme.sh
- /var/run/docker.sock:/var/run/docker.sock:ro
network_mode: bridge
volumes:
conf:
vhost:
html:
certs:
acme:
Test
curl -vvv -H "Host: beta.webuxlab.com" http://127.0.0.1 -L