Guide · Open source
How to use Traefik: setup, routing and HTTPS guide
Updated · written with AI from the project's own documentation and checked against our catalogue data
Traefik is an open-source HTTP reverse proxy and load balancer that sits in front of your web services and sends incoming traffic to the right one. This guide explains what it does, how to start it with Docker, and how it finds your services automatically. By the end you will know how to run Traefik, what it needs to work, and whether it fits your setup.
Quick start
- 1Install Docker. Traefik's quick start requires Docker. Make sure Docker is installed and running on your machine.
- 2Create a config file. Prepare a traefik.toml file, starting from the sample configuration file linked in the README.
- 3Run the Traefik image. Start the official Traefik Docker image with ports 8080 and 80 published and your config mounted.
- 4Connect a provider. Point Traefik at Docker, Swarm, Kubernetes, ECS or a File provider so it can discover your services.
- 5Check the web UI. Open the simple HTML frontend to confirm Traefik sees your providers and routes.
- 6Read the docs. Use the official documentation at doc.traefik.io for detailed configuration of routing, HTTPS and metrics.
What Traefik does and when you need it
Traditional reverse proxies require you to write a route for each service. Traefik instead listens to systems such as Docker, Swarm mode, Kubernetes, Consul or etcd and generates routes as services start, stop or scale.
The project is aimed at dynamic microservice setups. For a single static website or one app on one server, the README notes that a simpler web server may be enough.
- Good fit: many microservices in Docker, Swarm or Kubernetes that change often.
- Good fit: automatic HTTPS certificates via Let's Encrypt.
- Good fit: built-in metrics, access logs and a REST API.
- Less suited: one static site or one app on one server.
Install Traefik with Docker
The README's simplest route is the official Docker image. Docker is the only prerequisite listed. The command below runs the image with a sample config file mounted from your current directory and publishes ports 8080 and 80.
You can also run the binary directly with the sample configuration file, or get the sources with git. The sample configuration is available as traefik.sample.toml in the project repository.
docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml traefikGet the source code
If you want to read or modify the code, clone the repository from GitHub. The project is written in Go and released under the MIT licence.
git clone https://github.com/traefik/traefikConnect Traefik to your services
Traefik builds its configuration from providers. The README lists Docker and Swarm mode, Kubernetes, ECS and a File provider. Pointing Traefik at your orchestrator is meant to be the main configuration step, and the configuration updates without restarts.
If you prefer to define some routes manually, Traefik supports that as well through the File provider.
- Docker and Swarm mode: reads service information from the Docker API.
- Kubernetes: uses the Kubernetes CRD provider.
- ECS: for Amazon ECS.
- File: for routes you write yourself.
Enable HTTPS and check the dashboard
Traefik can provide HTTPS to your services by using Let's Encrypt, including wildcard certificates according to the feature list. It also includes a simple HTML web UI you can open to see providers and routes.
Traefik also exposes metrics (REST, Prometheus, Datadog, Statsd, InfluxDB 2.X), keeps access logs in JSON or CLF format, and offers a REST API.
Troubleshooting and getting help
The full documentation for Traefik v3 is at doc.traefik.io/traefik. For community help, the README points to the Traefik community forum. Commercial support is offered by Traefik.io by email.
When moving to a new major version, read the migration guide first to learn about breaking changes.
What people use it for
- Routing traffic to many containers in Docker or Swarm that start and stop often.
- Serving several microservices in Kubernetes under different paths or subdomains.
- Issuing HTTPS certificates for services through Let's Encrypt.
- Collecting Prometheus or InfluxDB metrics and JSON access logs from the proxy.
Frequently asked questions
Is Traefik free to use?
Traefik is released under the MIT licence, according to the README. Commercial support is available from Traefik.io by email if you need it.
What do I need to run Traefik?
The README lists Docker as the prerequisite for the quick start. You can also use the release binary or build from the source repository.
How do I install Traefik?
The simplest method in the README is to run the official Docker image with a sample config file. You can also download the binary from the releases page or clone the source with git.
Does Traefik support automatic HTTPS?
Yes. The README says Traefik provides HTTPS to your microservices by using Let's Encrypt, with wildcard certificate support.
Is Traefik better than NGINX or Caddy?
The source does not compare them directly. Traefik is designed to update routes automatically from orchestrators, while NGINX, HAProxy, Caddy and Envoy are alternatives you can evaluate for your needs.
Why is Traefik not working for my single website?
The README says a simpler web server may be enough for a single static website or one app on one server. Traefik is aimed at dynamic microservice setups.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Traefik suits teams running many microservices in Docker, Swarm or Kubernetes that change often and want routes updated automatically. If you only serve one static site or one app on one server, a simpler web server such as NGINX or Caddy may be a better choice.
Install options & downloads