All my attempt refers to putting traefik and some services on localhost with https. I already got it with traefik with the configuration shown below
- my docker-compose traefik.yml file
version: '3.5' networks: ntwkr_docker: external: true services: reverse-proxy: image: traefik:v2.6 container_name: wsl-traefik restart: unless-stopped security_opt: - no-new-privileges:true ports: # Web - 80:80 - 443:443 volumes: - /var/run/docker.sock:/var/run/docker.sock:ro # Map the static configuration into the container - ./traefik/config/static.yml:/etc/traefik/traefik.yml:ro # Map the dynamic configuration into the container - ./traefik/config/dynamic.yml:/etc/traefik/dynamic.yml:ro # Map the certificats into the container - ./traefik/certs:/etc/certs:ro networks: - ntwkr_docker
- my referred static.yml file
global: sendAnonymousUsage: false api: dashboard: true insecure: true providers: docker: endpoint: "unix:///var/run/docker.sock" watch: true exposedByDefault: false file: filename: /etc/traefik/dynamic.yml watch: true log: level: INFO format: common entryPoints: http: address: ":80" http: redirections: entryPoint: to: https scheme: https https: address: ":443"
- my referred dynamic.yml file
http: routers: traefik: rule: "Host(`traefik.docker.localhost`)" service: "api@internal" tls: domains: - main: "docker.localhost" sans: - "*.docker.localhost" - main: "domain.local" sans: - "*.domain.local" tls: certificates: - certFile: "/home/marconobre/.pki/nssdb/local-cert.pem" keyFile: "/home/marconobre/.pki/nssdb/local-key.pem"
And the big question:
What is the syntax of a docker-compose.yml file to run another service that is perceived and redirected by traefik to be accessed with https://.docker.localhost in the same way as I access the traefik dashboard with https ://traefik.docker.localhost ?