Skip to content

Instantly share code, notes, and snippets.

@pyaillet
Created December 6, 2021 16:39
Show Gist options
  • Save pyaillet/1a5d85e33a24efb2eb11f7456dc06206 to your computer and use it in GitHub Desktop.
Save pyaillet/1a5d85e33a24efb2eb11f7456dc06206 to your computer and use it in GitHub Desktop.
traefik constraintes
version: "3"
services:
blue:
image: containous/whoami
labels:
- traefik.http.routers.blue.rule=PathPrefix("/")
- color=blue
proxy:
image: traefik:v2.5.4
# Enables the web UI and tells Traefik to listen to docker
command:
- --providers.docker
- --providers.docker.constraints=Label(`color`,`blue`)
ports:
- "80:80"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
version: "3"
services:
green:
image: containous/whoami
labels:
- traefik.http.routers.green.rule=PathPrefix("/")
- color=green
proxy:
image: traefik:v2.5.4
# Enables the web UI and tells Traefik to listen to docker
command:
- --providers.docker
- --providers.docker.constraints=Label(`color`,`green`)
ports:
- "81:80"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment