Traefik 2.0 + Docker — a Simple Step by Step Guide

containeroo
2 min readSep 24, 2019
Source: https://docs.traefik.io/assets/img/traefik-architecture.png

Introduction

In this tutorial we will go trough the following things:

  1. Setup and configure Traefik in a Docker container
  2. Let’s Encrypt setup for automatic HTTPS certificates
  3. 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

--

--