In this scenario you'll learn how to use Træfɪk to load balance HTTP traffic between different Docker containers.
Træfɪk is a modern HTTP reverse proxy and load balancer designed for deploying microservices. Træfɪk has support for multiple backend providers, including Docker, to automatically configure the environment. As new services, or containers, are added and removed, the load balancer will reshape the traffic to match.
Image source https://traefik.io/
Congratulations! You've successfully deployed the Traefik load balancer for managing traffic to Docker container. More details on traefik can be found at https://traefik.io/

Steps
Load Balance Containers using Traefik
Step 1 - Define Traefik Container
This scenario uses Docker Compose to define the architecture, and Docker Container labels to define the metadata and rules for routing.
Create Traefik Container
Start creating the Docker Compose file by first defining the load balancer.
traefik: image: traefik command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG ports: - "80:80" - "8080:8080" - "443:443" volumes: - /var/run/docker.sock:/var/run/docker.sock - /dev/null:/traefik.toml
The Load Balancer is configured to list on ports 80 and 443 for HTTP traffic. It also has a web dashboard available on port 8080. The dashboard should be considered internal and restricted by a firewall.
The use of docker.sock allows traefik to listen to the Docker Host Daemon Events and reconfigure itself when containers are started/stopped. It also uses this to find additional metadata about the containers, such as which domain name they process.
You’ll love Katacoda

Guided Path
Knowing what you need to know is the hardest part. Our guided pathways help build your knowledge around real-world scenarios.

Learn By Doing
The best way to learn is by doing. All our tutorials are interactive with pre-configured live environments ready for you to use.

Stay up-to-date
It's a competitive industry. Your skills need to keep up with the latest approaches. Katacoda keeps your skills up-to-date.
You’ll love Katacoda

Guided Path
Knowing what you need to know is the hardest part. Our guided pathways help build your knowledge around real-world scenarios.

Learn By Doing
The best way to learn is by doing. All our tutorials are interactive with pre-configured live environments ready for you to use.

Stay up-to-date
It's a competitive industry. Your skills need to keep up with the latest approaches. Katacoda keeps your skills up-to-date.