Reputation: 607
I'm having some hard time with Traefik 2.x and its configuration options. I have the following docker-compose.yml file which should:
Contacting the machine's IP at port 8080 I can correctly see the Traefik dashboard. However, at port 80 I receive a 404
docker-compose.yml
:
version: "3"
services:
traefik:
container_name: "traefik"
image: "traefik:latest"
command:
- --api.insecure=true
- --api.dashboard=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --providers.docker.network=frontend
- --entrypoints.frontend.address=:80
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
labels:
- "traefik.enable=true"
networks:
- frontend
ports:
- "80:80"
- "8080:8080"
grafana:
container_name: "grafana"
image: "grafana/grafana:latest"
networks:
- frontend
- backend
labels:
- "traefik.enable=true"
- "traefik.docker.network=frontend"
- "traefik.port=3000"
networks:
frontend:
name: frontend
backend:
name: backend
Upvotes: 1
Views: 2074
Reputation: 607
I found the correct edit to my configuration. In the labels section inside the grafana container, it is needed to set a rule for Traefik in order to recognize the URL
- "traefik.http.routers.whoami.rule=Host(`myIPhere`)"
Where I have inserted the IP of my machine in the Host field Now Traefik recognizes the rule and routes the traffic incoming on port 80 to port 3000 as expected.
Upvotes: 1