This post will show you how to setup a , deploy a couple of microservices, and create a Reverse Proxy Service (with ) in charge of routing requests on their base URLs. Swarm Cluster Traefik If you haven’t already, create a Swarm cluster, you could use the shell script below to setup a cluster with 3 nodes (1 Manager & 2 Workers) Issue the following command to execute the script: chmod +x setup.sh ./setup.sh The output of the above command is as follows: At this moment, we have 3 nodes: Our example microservice application consists of two parts. The and the . For both parts I have prepared images for you that can be pulled from the . Books API Movies API DockerHub The for both images can be found on my . Dockerfiles Github Create file with the following content: docker-compose.yml We use an named , on which we add the services we want to expose to . overlay network traefik-net Traefik We use to deploy the APIs on workers & Traefik on Swarm manager. constraints Traefik container is configured to listen on port for the standard HTTP traffic, but also exposes port for a web dashboard. 80 8080 The use of docker socket ( ) allows Traefik to listen to events, and reconfigure itself when containers are started/stopped. /var/run/docker.sock Docker Daemon The label is used by Træfik to determine which container to use for which Request Path. traefik.frontend.rule The part create a configuration file for Traefik from (it enables the backend) configs config.toml Docker In order to deploy our stack, we should execute the following command: docker stack deploy — compose-file docker-compose.yml api Let’s check the overlay network: docker network ls Traefik configuration: docker config ls To display the configuration content: docker config inspect api_traefik-config — pretty And finally, to list all the services: docker stack ps api In the list of above, you can see that the 3 containers are being running on , & : node-1 node-2 node-3 If you point your favorite browser (not you IE) to the ( ) you should see that the frontends and backends are well defined: Traefik Dashboard URL http://MANAGER_NODE_IP:8080 If you check you will get a list of books: , http://MANAGER_NODE_IP/books If you replace the base URL with : /movies What happens if we want to scale out the books & movies APIs. With the command: docker service scale We can confirm that: Obviously did recognise that we started more containers and made them available to the right frontend automatically: Traefik In the diagram below, you will find that the manager has decied to schedule the new containers on (3 of them) and (4 of them) using the strategy: node-2 node-3 Round Robin