Skip to content

Instantly share code, notes, and snippets.

@gpilla gpilla/traefik-stack.yaml

Last active Apr 24, 2020
Embed
What would you like to do?
version: '3'
services:
reverse-proxy:
image: traefik:v2.2
command:
- --api.insecure=true
- --api.dashboard=true
- --providers.docker=true
- --providers.docker.swarmMode=true
- --providers.docker.exposedbydefault=false
- --providers.docker.network=proxy
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
ports:
# The HTTP port
- "80:80"
- "443:443"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
networks:
- proxy
deploy:
placement:
constraints:
- node.role == manager
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`dashboard.traefik.localhost`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.entrypoints=http"
- "traefik.http.services.api.loadbalancer.server.port=80"
networks:
proxy:
external: true
version: '3'
services:
whoami:
# A container that exposes an API to show its IP address
image: containous/whoami
networks:
- proxy
deploy:
labels:
- "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
- "traefik.enable=true"
- "traefik.http.routers.whoami.entrypoints=http"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
networks:
proxy:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.