This is a short guide to run all applications on ssl using docker with nginx+letsencrypt, it therefore utilizes jrcs letsencrypt companion.

1. NGINX Proxy

docker run -d -p 80:80 -p 443:443 \  
  --name nginx-proxy \
  -v /data/certs:/etc/nginx/certs:ro \
  -v /etc/nginx/vhost.d \
  -v /usr/share/nginx/html \
  -v /var/run/docker.sock:/tmp/docker.sock:ro \
  --label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true \

2. Letsencrypt Companion

Make sure the cert path matches the one of step 1

docker run -d \  
  --name letsencrypt-companion \
  -v /data/certs:/etc/nginx/certs:rw \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  --volumes-from nginx-proxy \

3. Example Container

VIRTUAL_PORT= is optional, however you will need it if your docker image EXPOSEs more than one port.

If you omit the LETSENCRYPT_* ENV variables your container will only be accessible over http.

docker run -d \  
  --name some-ghost \
  -e \
  -e VIRTUAL_PORT=2368 \
  -e \
  -e \
  -e "NODE_ENV=production" \
  -v /data/ghost/blog:/var/lib/ghost \

4. Success

You should now be able to access a blog at using https.