Isolating Docker images behind Nginx-proxy

so ive spent a good few hours on this, and can't make it work with multiple networks, below are the docker-compose files that work with a single network (nginx-proxy), can someone point me in the right direction to be able to split up the network so each website talks to the proxy but on separate networks?

Proxy

version: '3.6'

services: nginx: image: nginx labels: com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" container_name: nginx restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./conf.d:/etc/nginx/conf.d - ./vhost.d:/etc/nginx/vhost.d - ./html:/usr/share/nginx/html - ./certs:/etc/nginx/certs:ro

nginx-gen: image: jwilder/docker-gen command: -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf container_name: nginx-gen restart: unless-stopped volumes: - ./conf.d:/etc/nginx/conf.d - ./vhost.d:/etc/nginx/vhost.d - ./html:/usr/share/nginx/html - ./certs:/etc/nginx/certs:ro - /var/run/docker.sock:/tmp/docker.sock:ro - ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro

nginx-letsencrypt: image: jrcs/letsencrypt-nginx-proxy-companion container_name: nginx-letsencrypt restart: unless-stopped volumes: - ./conf.d:/etc/nginx/conf.d - ./vhost.d:/etc/nginx/vhost.d - ./html:/usr/share/nginx/html - ./certs:/etc/nginx/certs:rw - /var/run/docker.sock:/var/run/docker.sock:ro environment: NGINX_DOCKER_GEN_CONTAINER: "nginx-gen" NGINX_PROXY_CONTAINER: "nginx"

networks: default: external: name: nginx-proxy # dir and network

website 1 ,network 1

version: '3.6'

services: example.com: image: nginx restart: always environment: # NGINX-PROXY ENVIRONMENT VARIABLES: UPDATE ME - VIRTUAL_HOST=example.com - VIRTUAL_PORT=80 - LETSENCRYPT_HOST=example.com - LETSENCRYPT_EMAIL=[email protected] # END NGINX-PROXY ENVIRONMENT VARIABLES expose: - 80 networks: default: external: name: nginx-proxy

website 2 ,network 2

version: '3.6'

services: example1.com: image: nginx restart: always environment: # NGINX-PROXY ENVIRONMENT VARIABLES: UPDATE ME - VIRTUAL_HOST=example1.com - VIRTUAL_PORT=80 - LETSENCRYPT_HOST=example1.com - LETSENCRYPT_EMAIL=[email protected] # END NGINX-PROXY ENVIRONMENT VARIABLES expose: - 80 networks: default: external: name: nginx-proxy

/r/docker Thread Parent