Skip to content

Instantly share code, notes, and snippets.

@pyaillet
Created December 6, 2021 16:39
Show Gist options
  • Select an option

  • Save pyaillet/1a5d85e33a24efb2eb11f7456dc06206 to your computer and use it in GitHub Desktop.

Select an option

Save pyaillet/1a5d85e33a24efb2eb11f7456dc06206 to your computer and use it in GitHub Desktop.

Revisions

  1. pyaillet created this gist Dec 6, 2021.
    18 changes: 18 additions & 0 deletions docker-compose.blue.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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
    18 changes: 18 additions & 0 deletions docker-compose.green.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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