Quickstart Traefik v3 with Docker
masterTo set up Traefik v3 using Docker, follow these steps:
- Create a configuration file named
traefik.ymlto enable the Docker provider and the insecure dashboard UI:
# Docker configuration backend
providers:
docker:
defaultRule: "Host(`{{ trimPrefix `/` .Name }}.docker.localhost`)"
# API and dashboard configuration
api:
insecure: true- Run the Traefik v3 container. You must mount your
traefik.ymland the Docker socket to allow Traefik to communicate with the Docker engine:
docker run -d -p 8080:8080 -p 80:80 \
-v $PWD/traefik.yml:/etc/traefik/traefik.yml \
-v /var/run/docker.sock:/var/run/docker.sock \
traefik:v3- Deploy a backend service. For testing, you can run the
traefik/whoamiimage:
docker run -d --name test traefik/whoami- Verify access. The service should now be reachable via the hostname generated by the
defaultRule(e.g.,test.docker.localhost):
$ curl test.docker.localhost- Access the Dashboard. Navigate to
http://localhost:8080in your browser to view routers, services, and middlewares.