Hey,
Thanks for the project!
I'm having an issue getting this going with my setup. I'm on Fedora 24, using Docker 1.10.3 and Docker-compose 1.7.1.
I've got a docker-compose.yml file set up like this:
nginx:
image: jwilder/nginx-proxy
container_name: nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "./volumes/etc/nginx/vhost.d:/etc/nginx/vhost.d"
- "./volumes/etc/nginx/certs:/etc/nginx/certs:ro"
- "./volumes/usr/share/nginx/html:/usr/share/nginx/html"
security_opt:
- "label:type:docker_t"
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
restart: always
volumes_from:
- nginx
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./volumes/etc/nginx/certs:/etc/nginx/certs:rw"
I'm getting this output in the logs when I spin up the container:
nginx | forego | starting nginx.1 on port 5000
nginx | forego | starting dockergen.1 on port 5100
nginx | dockergen.1 | 2016/09/05 04:54:35 Generated '/etc/nginx/conf.d/default.conf' from 1 containers
nginx | dockergen.1 | 2016/09/05 04:54:35 Running 'nginx -s reload'
nginx | dockergen.1 | 2016/09/05 04:54:35 Watching docker events
letsencrypt_1 | Error: can't get nginx-proxy container id !
letsencrypt_1 | Check that you use the --volumes-from option to mount volumes from the nginx-proxy.
...
This line in entrypoint.sh is where the problem is coming from. After some debugging, I saw that the call of docker_api "/containers/$CONTAINER_ID/json" was returning nothing (the curl command it was executing was this: curl -s --unix-socket /var/run/docker.sock -XGET http:/containers/$CONTAINER_ID/json).
Any idea what's going on?
Like said in the log it seems that the nginx volumes are not mount into the letsencrypt container.
I never use docker-compose to start the containers. For working docker-compose examples look in the README (in the examples section)
In fact, it mounts. The issue is that this makes use of multi mounting in case you wan't to scale.
@nwallace Please do this change:
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
restart: always
volumes_from:
- - nginx
+ - container:servicename_nginx_1
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./volumes/etc/nginx/certs:/etc/nginx/certs:rw"
Inspite, IMO it should also be supported by exposing it over an ENV VAR.
had the same problem -> removed container and built again
I had the same issue. For me the problem was that docker-compose sometimes startet the nginx container AFTER the letsencrypt companion. I solved with depends:
version: '3.5'
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- html:/usr/share/nginx/html
- dhparam:/etc/nginx/dhparam
- vhost:/etc/nginx/vhost.d
- certs:/etc/nginx/certs:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nginx-proxy-lets-encrypt
depends_on:
- "nginx-proxy"
volumes:
- certs:/etc/nginx/certs:rw
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
certs:
html:
vhost:
dhparam:
Most helpful comment
I had the same issue. For me the problem was that docker-compose sometimes startet the nginx container AFTER the letsencrypt companion. I solved with
depends: