Traefik 2.0 + Docker — a Simple Step by Step Guide
2 min readSep 24, 2019
Introduction
In this tutorial we will go trough the following things:
- Setup and configure Traefik in a Docker container
- Let’s Encrypt setup for automatic HTTPS certificates
- Deploy a simple service (Portainer) and expose it to the internet
You will find all the required configuration files in our Git repository.
EDIT: Unfortunately there is currently an issue with embedded Gists on the Medium Desktop site (mobile works fine). You can find all our Gists here.
Prerequisites
In order to follow along, you need these things:
- Docker (obviously)
- Docker Compose
- A domain
- Ports 80 and 443 forwarded to your Docker host
Setup and configure Traefik with Let’s Encrypt
Let’s get started by setting up Traefik.
First, create a directory for our containers:
mkdir -p /opt/containers/{traefik,portainer}
Create the data folder and config files for Traefik:
mkdir -p /opt/containers/traefik/data