Mar 17, 2025
Setting Up Traefik Proxy with Docker Compose: A Step-by-Step Guide
Learn how to install and configure Traefik Proxy in Docker Compose. Set up entry points, enable service discovery, and use the Whoami container for debugging.
Author


Book a call
Table of Contents
In this post, I'll show you how to install Traefik Proxy — the cloud native application proxy in our Docker Compose file and utilize it in our architecture with a sample service container. Traefik Proxy was discussed in my previous post — How much do you know "Traefik" proxy?
As a baseline, I'm assuming you're familiar with Docker and Docker Compose files.
Let's get started —
Docker Compose
- Add the following content to your
docker-compose.ymlfile
Details (of the content mentioned in Docker Compose file)
- Replace
localhostwith your own domain or sub-domain in service containerwhoami - Run
docker-compose.ymlfile by using the commanddocker-compose up -d - Your server should be up and running. Visiting
http://localhost:1337/whoami, will show you all request headers - I'm using Traefik's whoami service as an example, it is a tiny Go server that prints os information and HTTP request to output
- The above mini snapshot shows how we define entry point in Traefik
- This allows us to "open and accept" HTTP traffic
- The above mini snapshot shows how we configure & expose Traefik's API and Dashboard.
- By default, Traefik will listen on port 8080 for API requests
- This is a fully optional step; we may disable the Dashboard and secure APIs if you do not want to.
- To enable and customise the log and it's level, we can use the command as mentioned above
- Accepted values, in order of severity -
DEBUG,INFO,WARN,ERROR,FATAL&PANIC
- To enable docker as a providers for Traefik configuration, we set the value as true against
providers.docker - If we want to enable all the service containers within the docker-compose file, we can set the value as true against
providers.docker.exposedbydefault - But, I'd recommend to not expose all service containers unless really needed
- If choose to not explicitly expose all your service containers, then you'd need to enable each container service by setting
traefik.enableas true - To allow request only from your predefined entry point, we set
traefik.http.routes.whoami.entrypointwith the name value we defined in ourtraefikservice - in our case, it is web
Screenshots
Traefik Dashboard

Traefik Dashboard's Routers List

Whoami Service Container

Summary
After reading this article, you will have a fundamental grasp on how to setup Traefik Proxy in your Docker Compose with a service.
And I strongly advise everyone to have the "traefik/whoami" service container ready for debugging request headers if something goes wrong.
Source: This blog is authored by Faiz Ahmed, Principal Technical Consultant at GeekyAnts. Originally published on Hashnode: Read here.
Subscribe to Our Newsletter
Subscribe to RSS
Press & Media Hub RSS FeedRelated Articles.
More from the engineering frontline.
Dive deep into our research and insights on design, development, and the impact of various trends to businesses.

Jul 10, 2026
How We Built the Missing Bridge from Code to Figma

Jun 27, 2026
Building a Resilient Hybrid-Cloud Network with WireGuard HA, Route-Based Failover, and Deep Observability

Jun 19, 2026
We Built a 114-Second AWS-to-Azure Failover. Here’s What We Learned

Jun 12, 2026
Cloud-Native and Cloud-Agnostic Are Not Ideologies; They Are Business-Stage Decisions

Jun 8, 2026
Geeklego: The Open-Source Design System Built to Work With AI

May 18, 2026