Skip to content

Instantly share code, notes, and snippets.

@gpilla
Last active April 24, 2020 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpilla/673a9850f607a3d2408614c2ca5a31d1 to your computer and use it in GitHub Desktop.
Save gpilla/673a9850f607a3d2408614c2ca5a31d1 to your computer and use it in GitHub Desktop.
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