Docker-compose with let’s encrypt: TLS Challenge
For the TLS challenge you will need:
- A publicly accessible host allowing connections on port with docker & docker-compose installed.
- A DNS record with the domain you want to expose pointing to this host.
- Create a
docker-compose.yml
on your remote server with the following content:
- Replace
[[email protected]](https://doc.traefik.io/cdn-cgi/l/email-protection)
by your own email within thecertificatesresolvers.myresolver.acme.email
command line argument of thetraefik
service. -
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
Run
docker-compose up -d
within the folder where you created the previous file.
Note
What changed between the basic example:
- We replace the entry point by one for the https traffic:
- We configure the Https let’s encrypt challenge:
# Enable a tls challenge named "myresolver"
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
- We add a volume to store our certificates:
- We configure the
whoami
service to tell Traefik to use the certificate resolver namedmyresolver
we just configured:
labels:
# Uses the Host rule to define which certificate to issue