Open Julianoe opened 6 years ago
Yes, using the current version is probably a good idea. I believe the only change you would have to make is handle/replace the volumes_from
statements that have been removed from v3.
Hi, it seems doesn't work without volumes_from, I got this error message: Error: can't get nginx-proxy container ID !
https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion/issues/19
PS, has anyone successfully setup this with docker-compose version 3?
Changed to version 2.
I did the same, here is my conf.
volumes:
CONFD:
VHOSTD:
NGINX-HTML:
networks:
homeserver-net:
ipam:
driver: default
config:
- subnet: 172.28.0.0/16
services:
nginx:
restart: always
image: nginx
container_name: nginx
ports:
- 80:80
- 443:443
volumes:
- CONFD:/etc/nginx/conf.d
- VHOSTD:/etc/nginx/vhost.d
- NGINX-HTML:/usr/share/nginx/html
- ./volumes/proxy/certs:/etc/nginx/certs:ro
networks:
- homeserver-net
nginx-gen:
restart: always
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./volumes/proxy/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
- CONFD:/etc/nginx/conf.d
- VHOSTD:/etc/nginx/vhost.d
- NGINX-HTML:/usr/share/nginx/html
- ./volumes/proxy/certs:/etc/nginx/certs: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
networks:
- homeserver-net
letsencrypt-nginx-proxy-companion:
restart: always
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
#volumes_from:
#- nginx
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./volumes/proxy/certs:/etc/nginx/certs:rw
- CONFD:/etc/nginx/conf.d
- VHOSTD:/etc/nginx/vhost.d
- NGINX-HTML:/usr/share/nginx/html
- ./volumes/proxy/certs:/etc/nginx/certs:ro
environment:
- NGINX_DOCKER_GEN_CONTAINER=nginx-gen
- NGINX_PROXY_CONTAINER=nginx
networks:
- homeserver-net
portainer:
image: portainer/portainer
ports:
- 9000:9000
restart: always
environment:
- VIRTUAL_HOST=
- VIRTUAL_PORT=9000
- VIRTUAL_NETWORK=nginx-proxy
- LETSENCRYPT_HOST=
- LETSENCRYPT_EMAIL=
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /mnt/R3T/portainer:/data
networks:
homeserver-net:
ipv4_address: 172.28.1.4```
Thanks @Sch-Tomi!
Adding the NGINX_PROXY_CONTAINER=nginx-proxy
did the trick.
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
:
checkout https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion/issues/102#issuecomment-463573796
I'm trying to get a grip at Docker and i struggle a bit. What i'm trying to achieve is exactly what you seem to be describing in your tutorial. Multiple websites, nginx proxy, let's encrypt. The only difference is that i would use a Wordpress image because most of my websites are Wordress installs.
I see that you use a docker-compose v2: does that mean that this is outdated and i should avoid using it as a way of learning and trying to make my server work? Should i adapt it (if i can) to v3? Or it does not really matter?