
Member-only story
Docker + Traefik
Create a microservice architecture and handle routing
Docker is a container management tool and Traefik is a reverse proxy for managing the routing between containers. With both tools, you can create a microservice architecture.
This quick tutorial will focus on developing with Docker and Traefik. Thus, it won’t go over Docker swarm mode very much (which is for running Docker on multiple machines).
I’ll be using this repo for the tutorial: https://github.com/efossas/CRUD. It’s for creating a CRUD application. It’s super simple to set up. Run the commands below and set up DNS to route crud.docker.localhost & traefik.docker.localhost to localhost (127.0.0.1). The easy way to do that is to edit /etc/hosts
git clone https://github.com/efossas/CRUD
cd CRUD
docker-compose up -d
Btw, it helps to have a strong understanding of how Unix shells work to really understand Docker.

What This Tutorial Covers
- Docker basics
- Building a Docker image
- Docker terminology
- Using Docker Compose
- Using Traefik with Docker
What You Need For This Tutorial
Docker
Docker (Basics)
Docker is a set of tools for managing containers. A container is essentially a sandboxed user level operating system with a single running process.
Run the following command and you will be put inside a container with the Alpine operating system. It’s running process is the ASH unix shell, so you can run typical commands like ls, cd, pwd, etc. To exit the container, run exit.
docker run -it alpine