I want to use my own certificate with traefik, unfortunately tls is not getting verified. The following error from traefik logs:
dir structure as below
- docker-compose.yaml
- certs/tls.yml
- certs/dev.mydomain.com.crt
- certs/dev.mydomain.com.key
time="2022-04-29T13:34:35Z" level=debug msg="http: TLS handshake error from 185.188.35.10:7815: remote error: tls: unknown certificate"
time="2022-04-29T13:34:37Z" level=debug msg="Serving default certificate for request: \"self.dev.mydomain.com\""
Here is my docker-compose.yaml
version: "3.3"
services:
traefik:
image: "traefik:v2.6"
container_name: "traefik"
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--providers.file.directory=/etc/certs/"
- "--providers.file.watch=true"
ports:
- "443:443"
- "8080:8080"
- "80:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./certs:/etc/certs"
fcc:
image: "nginx"
container_name: "fcc"
labels:
- "traefik.enable=true"
- "traefik.http.routers.fcc.rule=Host(`self.dev.mydomain.com`)"
- "traefik.http.routers.fcc.entrypoints=websecure"
- "traefik.http.routers.fcc.tls=true"
and the
tls.yaml
tls:
certificates:
- certFile: ./dev.mydomain.com.crt
keyFile: ./dev.mydomain.com.key
Where do I do wrong?