Skip to content

Instantly share code, notes, and snippets.

@kopiro
Last active January 13, 2018 11:31
Show Gist options
  • Save kopiro/8b6204d869df7d8cbaf59a7db2fa45f6 to your computer and use it in GitHub Desktop.
Save kopiro/8b6204d869df7d8cbaf59a7db2fa45f6 to your computer and use it in GitHub Desktop.
Docker proxy with NGINX companion + LE
version: '3'
networks:
proxy:
external:
true
services:
app:
image: [IMAGE]
restart: always
networks:
- proxy
environment:
- VIRTUAL_HOST=[IMAGE].[SERVER]
- LETSENCRYPT_HOST=[IMAGE].[SERVER]
- LETSENCRYPT_EMAIL=[EMAIL]
#!/bin/sh
docker network create proxy
mkdir -p /root/proxy/certs
mkdir -p /root/proxy/conf
touch /root/proxy/conf/nginx.conf
docker stop proxy
docker stop proxy-le
docker rm proxy
docker rm proxy-le
docker run -d \
-p 80:80 \
-p 443:443 \
-e ENABLE_IPV6=true \
-v /root/proxy/certs:/etc/nginx/certs \
-v /etc/nginx/vhost.d \
-v /usr/share/nginx/html \
-v /root/proxy/conf/nginx.conf:/etc/nginx/conf.d/my_proxy.conf:ro \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
--name proxy \
--net proxy \
--label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy \
--restart=always \
jwilder/nginx-proxy:alpine
docker run -d \
-v /root/proxy/certs:/etc/nginx/certs:rw \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
--volumes-from proxy \
--name proxy-le \
--net proxy \
--restart=always \
jrcs/letsencrypt-nginx-proxy-companion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment