Traefik: Docker Containers Not Detected — Fix
The Problem
Traefik is running but doesn’t route traffic to your containers. The dashboard shows no routers or services, or routes show as “not found.” Docker containers with Traefik labels are ignored.
Updated March 2026: Verified with latest Docker images and configurations.
The Cause
Traefik discovers containers through the Docker socket. Common reasons for failure:
- Docker socket not mounted in the Traefik container
--providers.docker=truenot set in Traefik’s static configuration- Containers are on a different Docker network than Traefik
- Labels have typos or use wrong syntax
traefik.enable=falseis set (orexposedByDefault=falseandtraefik.enable=trueis missing)
The Fix
Method 1: Mount the Docker Socket
Verify the Docker socket is mounted in your docker-compose.yml:
services:
traefik:
image: traefik:v3.6.11
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
Method 2: Fix Network Configuration
Traefik must share a Docker network with the containers it routes to:
services:
traefik:
image: traefik:v3.6.11
networks:
- proxy
myapp:
image: myapp:latest
labels:
- "traefik.enable=true"
- "traefik.http.routers.myapp.rule=Host(`app.example.com`)"
- "traefik.docker.network=proxy"
networks:
- proxy
networks:
proxy:
external: true
Create the network first: docker network create proxy
If a container is on multiple networks, you must specify which network Traefik should use with the traefik.docker.network label.
Method 3: Enable Container Exposure
If you set --providers.docker.exposedbydefault=false (recommended), each container must explicitly opt in:
labels:
- "traefik.enable=true"
Without this label, Traefik ignores the container entirely.
Method 4: Verify Label Syntax
Common label mistakes:
# WRONG — missing router name
- "traefik.http.routers.rule=Host(`app.example.com`)"
# CORRECT — includes router name
- "traefik.http.routers.myapp.rule=Host(`app.example.com`)"
# WRONG — backticks missing
- "traefik.http.routers.myapp.rule=Host(app.example.com)"
# CORRECT — backticks around hostname
- "traefik.http.routers.myapp.rule=Host(`app.example.com`)"
Prevention
- Always use
--providers.docker.exposedbydefault=falseand explicitly enable containers withtraefik.enable=true - Create a dedicated
proxynetwork and add both Traefik and proxied containers to it - Test label syntax with
docker inspect <container>to verify labels are applied correctly - Check Traefik dashboard (port 8080) to see which routers and services are detected
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments