Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created November 1, 2017 19:07
Show Gist options
  • Save mlabouardy/638c382e8996a81015e3839b224af4bf to your computer and use it in GitHub Desktop.
Save mlabouardy/638c382e8996a81015e3839b224af4bf to your computer and use it in GitHub Desktop.
Traefik example with Swarm mode
version: "3.3"
services:
traefik:
image: traefik:1.4
ports:
- 80:80
- 8080:8080
networks:
- traefik-net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
configs:
- source: traefik-config
target: /etc/traefik/traefik.toml
deploy:
placement:
constraints:
- node.role == manager
books:
image: mlabouardy/books-api
networks:
- traefik-net
deploy:
placement:
constraints:
- node.role == worker
labels:
- "traefik.port=5000"
- "traefik.backend=books"
- "traefik.frontend.rule=Path:/books"
movies:
image: mlabouardy/movies-api
networks:
- traefik-net
deploy:
placement:
constraints:
- node.role == worker
labels:
- "traefik.port=5000"
- "traefik.backend=movies"
- "traefik.frontend.rule=Path:/movies"
networks:
traefik-net:
driver: overlay
configs:
traefik-config:
file: config.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment