According to Traefik Docs:
“Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.”
Also from Traefik Docs:
“...It receives requests on behalf of your application and finds out which components are responsible for handling them.
What sets Traefik apart, besides its many features, is that it automatically discovers the right configuration for your services. The magic happens when Traefik inspects your infrastructure, where it finds relevant information and discovers which service serves which request.”
Traefik can be integrated with all major infrastructure providers such as Docker, Swarm mode, Amazon Elastic Container Service (Amazon ECS), Kubernetes, etc.
Recently, Traefik released its next major version upgrade of 2.0. This article covers one of the effects of this new release and how it led to breaking a downstream project.
Currently, we are explaining Traefik usage with Docker.
About Traefik-helper
In one of our recent applications, we integrated Traefik using Traefik helper. We have integrated Traefik along with Apache in the Docker compose YML file as shown below.
Use this Traefik docker container with docker-compose.
We have a shell script inside this repo. To manage the Docker container, use as below:
The problem
While integrating Traefik-helper into our project, we faced an issue. Traefik-helper requires Traefik 1.x for it to work properly. It has not been updated to work with Traefik 2, which was recently released.
However, it does not specify a tag for the Traefik Docker image, which makes it always pick the latest Traefik image. The shell script that executes docker-compose throws the following error. This would happen even if you run docker-compose directly.
Error handling
To resolve this issue, we have to change the Traefik Docker image version that is currently being used in Traefik-helper repo.
Instead of using the latest Traefik image, we modified the Traefik image version from the latest to the stable 1.7 image version in traefik-helper.default.yml that can be found inside the Traefik-helper folder.
This resolves the error, and the Traefik container will start working without any errors.
Best practices
As a best practice, always use versioning. This helps tackle errors related to upgrades for the various libraries we use.
Kiran Tej, Business Automation Engineer II
“KT” is an avid dreamer trying to fulfil his dreams. He’s creative, adventurous, and loves to experiment—when he’s not at work, he’s out exploring.
Leave us a comment