The Traefik project has an official Docker image, so we will use that to run Traefik in a Docker container.
But before we get our Traefik container up and running, we need to create a configuration file and set up an encrypted password so we can access the monitoring dashboard.
We’ll use the htpasswd
utility to create this encrypted password. First, install the utility, which is included in the apache2-utils
package:
sudo apt-get install apache2-utils
Then generate the password with htpasswd
. Substitute secure_password
with the password you’d like to use for the Traefik admin user:
htpasswd -nb admin secure_password
The output from the program will look like this:
Output
admin:$apr1$ruca84Hq$mbjdMZBAG.KWn7vfN/SNK/
You’ll use your unique output in the Traefik configuration file to set up HTTP Basic Authentication for the Traefik health check and monitoring dashboard. Copy your entire output line so you can paste it later. Do not use the example output.
To configure the Traefik server, we’ll create a new configuration file called traefik.toml
using the TOML format. TOML is a configuration language similar to INI files, but standardized. This file lets us configure the Traefik server and various integrations, or providers
, that we want to use. In this tutorial, we will use three of Traefik’s available providers: api
, docker
, and acme
. The last of these, acme
supports TLS certificates using Let’s Encrypt.
#traefik #docker #docker containers #ubuntu 20.04