Skip to content

Instantly share code, notes, and snippets.

@gmolveau
Last active February 7, 2024 12:32
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 gmolveau/1393719020c675b38d6c5ddb02d4bd55 to your computer and use it in GitHub Desktop.
Save gmolveau/1393719020c675b38d6c5ddb02d4bd55 to your computer and use it in GitHub Desktop.
docker compose traefik dns resolving inter containers
version: "3.3"
services:
traefik:
image: "traefik:v3.0"
container_name: "traefik"
command:
#- "--log.level=DEBUG"
- "--api.dashboard=true"
- "--ping=true"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--providers.docker.network=traefik_proxy"
networks:
traefik_proxy:
aliases:
- whoami.localhost # insert here every others traefik-exposed containers' domains
- traefik.localhost
labels:
traefik.enable: "true"
traefik.http.routers.dashboard.rule: Host(`traefik.localhost`)
traefik.http.routers.dashboard.service: api@internal
ports:
- "80:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
whoami:
image: "traefik/whoami"
container_name: "whoami"
networks:
- traefik_proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
- "traefik.http.routers.whoami.entrypoints=web"
curl:
image: curlimages/curl:8.6.0
command: "whoami.localhost"
networks:
- traefik_proxy
depends_on:
whoami:
condition: service_started
networks:
traefik_proxy:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment