Skip to content

Instantly share code, notes, and snippets.

@timtan
Created March 13, 2025 06:37
Show Gist options
  • Select an option

  • Save timtan/fee57a113e5d23374ad3af2318312eca to your computer and use it in GitHub Desktop.

Select an option

Save timtan/fee57a113e5d23374ad3af2318312eca to your computer and use it in GitHub Desktop.
version: '3.8'
services:
traefik:
image: traefik:v2.10
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.swarmMode=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=traefik-public"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080" # Traefik dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- traefik-public
deploy:
placement:
constraints:
- node.labels.web == true
httpbin:
image: arnaudlacour/httpbin
environment:
GUNICORN_CMD_ARGS: "--capture-output --error-logfile - --access-logfile - --access-logformat '%(h)s %(t)s %(r)s %(s)s Host: %({Host}i)s}'"
networks:
- traefik-public
deploy:
placement:
constraints:
- node.labels.gateway == true
labels:
- "traefik.enable=true"
- "traefik.http.routers.httpbin.rule=PathPrefix(`/`)"
- "traefik.http.routers.httpbin.entrypoints=web"
- "traefik.http.services.httpbin.loadbalancer.server.port=80"
- "traefik.port=80"
networks:
traefik-public:
driver: overlay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment