My Traefik Set Up on Docker
My Traefik Setup with Docker: A Simple Reverse Proxy for My Homelab I've been running several services on Docker, and at some point managing ports, domains, HTTPS certificates, and reverse-proxy configuration manually became annoying. That's where Traefik became useful. Instead of configuring Nginx every time I deploy a new service, I can let Traefik discover my Docker containers and route…
A Simple Reverse Proxy for My Homelab
Running several services on Docker led to managing ports, domains, HTTPS certificates, and reverse-proxy configuration manually, which became tedious. Using Traefik addressed this issue by allowing Traefik to discover Docker containers and route traffic based on labels.
The Setup
Several services, such as Pi-hole, Vaultwarden, applications, and monitoring tools, were running on the same server. A reverse proxy was needed to simplify the URLs, enable HTTPS, and reduce manual configurations.
Architecture
Traefik acted as the reverse proxy, with Docker containers running inside a dedicated Docker network. Docker Compose was used to create the network and define the Traefik container. Traefik inspected Docker containers using the Docker socket mounted as read-only.
Traefik Configuration
Traefik required minimal static configuration. It had an API dashboard enabled, consumed Docker events via the Docker socket, and configured entry points for HTTP and HTTPS. The ACME integration for Let's Encrypt was also set up for automated certificate management.
Routing with Docker Labels
Traefik's power lay in its ability to automatically route traffic based on Docker labels. By adding specific labels to their services, users could define the routing rules, HTTP/HTTPS protocols, and certificate resolution.
HTTPS
Let's Encrypt was integrated with Traefik's ACME functionality, allowing for automatic certificate issuance and renewal. Services could easily reference the Let's Encrypt certificate resolver in their Traefik configuration.
HTTP → HTTPS Redirection
HTTP traffic could be redirected to HTTPS for enhanced security. This redirection was configured within Traefik's entry points, ensuring a smooth transition from HTTP to HTTPS.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.