Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker-compose file v3 version? #8

Open
Julianoe opened this issue Dec 5, 2017 · 6 comments
Open

Docker-compose file v3 version? #8

Julianoe opened this issue Dec 5, 2017 · 6 comments

Comments

@Julianoe
Copy link

Julianoe commented Dec 5, 2017

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?

@gilyes
Copy link
Owner

gilyes commented Dec 5, 2017

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.

@towry
Copy link

towry commented Jul 30, 2018

Hi, it seems doesn't work without volumes_from, I got this error message: Error: can't get nginx-proxy container ID !

nginx-proxy/acme-companion#19

PS, has anyone successfully setup this with docker-compose version 3?

@towry
Copy link

towry commented Jul 31, 2018

Changed to version 2.

@Sch-Tomi
Copy link

Sch-Tomi commented Aug 5, 2018

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```

@taigfs
Copy link

taigfs commented Oct 11, 2018

Thanks @Sch-Tomi!

Adding the NGINX_PROXY_CONTAINER=nginx-proxy did the trick.

@qwertzui11
Copy link

qwertzui11 commented Feb 14, 2019

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 nginx-proxy/acme-companion#102 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants