How do I use a TLS certificate within docer-compose

Hi, I am completely new to docker and traefik in particular.

I want to run the project https://github.com/Informatic/workadventure/tree/feature/animated-tiles and wanted to add a TLS certificate to it. I already acquired a certificate from Letsencrypt and since it is only a short term project, I don't need a auto renewal solution.

Thanks in advance for helping.

Update: I finally got to a point where I have been able to establish a secure connection using my certificate, however I now get only 404's.

Changes I made:
additional files

project dir
 | - traefik.yml
 | - dynamic_conf.yml
 | - certs
      | - cert.pem
      | - privkey.pem

dynamic_conf.yml:

# Dynamic configuration
tls:
  certificates:
    - certFile: "/etc/traefik/certs/cert.pem"
      keyFile: "/etc/traefik/certs/privkey.pem"

traefik.yml:

## traefik.yml
## Static configuration
entryPoints:
        web:
                address: ":80"
        websecure:
                address: ":443"


# Docker configuration backend
providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
    watch: true
  file:
    filename: /etc/traefik/dynamic_conf.yml
    watch: true

api:
        insecure: true

docker-compose.yaml:

services:
  reverse-proxy:
    image: traefik:v2.0
    command:
      - --api.insecure=true
      - --providers.docker
      - --entryPoints.web.address=:80
      - --entryPoints.websecure.address=:443
    ports:
      - "80:80"
      - "443:443"
      # The Web UI (enabled by --api.insecure=true)
      - "8080:8080"
    depends_on:
      - back
      - front
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.yml:/etc/traefik/traefik.yml
      - ./dynamic_conf.yml:/etc/traefik/dynamic_conf.yml
      - ./certs:/etc/traefik/certs
…

Found the issue:
traefik.yml:

providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
  file:
    filename: /etc/traefik/dynamic_conf.yml

This works like a charm

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.