I've got a setup similar to this (Docker-compose with network_mode: "service:[service name]") where I have a few containers behind a vpn container that i'm attempting to connect traefik with. Putting the labels for one container on the first "vpn" container works for that single container but i've got a couple I'm trying it with. I found that adding multiple router and serivce labels to a single container does not work. Is there a way that I could make this work?
Multiple labels for different containers definitely works. I have three containers on my vpn container.
openvpn:
image: ghcr.io/wfg/openvpn-client
container_name: openvpn
restart: always
networks:
- internal
- proxy
environment:
- SUBNETS=${OPENVPN_NETWORKS}
- KILL_SWITCH=on
- VPN_LOG_LEVEL=3
volumes:
- ${DOCKERDIR}/openvpn:/data/vpn:rw
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
labels:
traefik.enable: true
# First Router
traefik.http.routers.abc.entrypoints: web-secure
traefik.http.routers.abc.middlewares: authelia
traefik.http.routers.abc.rule: Host(`abc.${DOMAINNAME}`)
traefik.http.routers.abc.service: abc
# Second Router
traefik.http.routers.def.entrypoints: web-secure
traefik.http.routers.def.rule: Host(`def.${DOMAINNAME}`)
traefik.http.routers.def.service: def
# Third Router
traefik.http.routers.ghi.entrypoints: web-secure
traefik.http.routers.ghi.middlewares: authelia
traefik.http.routers.ghi.rule: Host(`ghi.${DOMAINNAME}`)
traefik.http.routers.ghi.service: ghi
traefik.http.routers.ghi.priority: 99
# Fourth Router
traefik.http.routers.jkl.entrypoints: web-secure
traefik.http.routers.jkl.rule: Query(`apikey`, `${GHI_API_KEY}`)
traefik.http.routers.jkl.service: ghi
traefik.http.routers.jkl.tls.options: docker@file
traefik.http.routers.jkl.priority: 100
# Services
traefik.http.services.abc.loadbalancer.server.port: 6595
traefik.http.services.abc.loadbalancer.server.scheme: http
traefik.http.services.def.loadbalancer.server.port: 8010
traefik.http.services.def.loadbalancer.server.scheme: http
traefik.http.services.ghi.loadbalancer.server.port: 8080
traefik.http.services.ghi.loadbalancer.server.scheme: http
huh.... well obviously I missed something.. LOL
Thanks! Let me see what I fudged.