Traefik is Awesome

Traefik is Awesome

So I recently thought of changing all my reverse proxy configuration from nginx installed in bare metal to something inside of docker. Why, you ask? I don't know, I felt like it. Meanwhile, I stumbled upon Traefik,  and I was ecstatic with its ability to manage Docker services over a reverse proxy. And, I thought, it would help me learn something new while installing and managing it. So, Traefik would be something refreshing to learn.

What's up with Nginx?

No complaints with Nginx there. Nginx is awesome. And most of the people that I come across, use Nginx in their server, and it does what it's supposed to do.

But me, I usually run many services in my self-hosted setup. Some are for testing only, some are in Production. Test containers don't work out most of the time. So I need to scrap them and then build a new container. The kinda messy guy like myself (and lazy), managing nginx configuration along with docker was a cumbersome thing. My laziness of maintenance is what motivates me to find an optimal solution to my existing setup and automate things.

And there comes Traefik to the rescue!

Traefik? As in, traffic?

Uh, uh! It's traefik! And it's an amazing tool to manage things running inside of docker. Earlier I used to create an Nginx config for the service running on docker and then remove the config when I no longer needed it. Adding and removing configs was an extra-work which could have been automated.

Now, traefik does all that for me. All I have to tell traefik where to look for the service running on my setup, and Boom! It downloads the certificates from Lets-Encrypt, and deploys them, opens an HTTPS connection and now my service is accessible over the internet.

Mind you, I didn't fiddle with configuration files at all. All I told Traefik was, “Hey Traefik, I'm running Mastodon, will you please let my friends and family access it over” And the Traefik goes “Sure pal!” and it does it.

So that makes server management so easier since I don't have to worry about certificates and config files anymore. That's cool!

How do I try it?

I'm glad you asked. It's really easy if you know how to use Docker and understand the basics of how docker networking works. I have added my configuration files here on my Git repo.

This write-up from will explain things concisely and with better detail and examples. Which is enough for you to get your traefik setup up and running in no time. Too bad that they don't offer a traefik image anymore. But you can always use the official one from Docker hub.

Just in case you stumbled upon issues, you can always contact me and let's try to get it sorted. Happy Experimenting!

Show Comments