Change Traefik default certificate

Hi,

I just want to simply change my default certificate with the one from my provider.

docker compose file:
reverse-proxy:
image: traefik:v2.5.6
restart: always
container_name: traefik
ports:

  • "80:80"
  • "8080:8080"
  • "443:443"
    volumes:
  • "/var/run/docker.sock:/var/run/docker.sock:ro"
  • "$PWD/data_traefik/traefik.yml:/etc/traefik/traefik.yml"

And my traefik yaml file:

global:
checkNewVersion: true
sendAnonymousUsage: false

log:
level: DEBUG

api:
dashboard: true
insecure: true

entryPoints:
web:
address: :80

websecure:
address: :443

tls:
stores:
default:
defaultCertificate:
certFile: /home//docker/data_traefik/cert.cer
keyFile: /home//docker/data_traefik/cert-key.key

providers:
docker:
exposedByDefault: false

But I still see the error that no default cert was found and the generic one is generated. I dont see the obvious problem :frowning:

I see you're mounting two volumes, one for the Docker socket, the other with the config file so Traefik running inside the container can read the mounted file.

However, your certFile and keyFile settings point to paths that look like they don't exist in the container. Remember that Traefik is running in the container and can't reach paths on the host unless you specifically mount them.

So add a volume that makes the /home//docker/data_traefik/ directory available somewhere in the container (maybe /ssl?). Then update the certFile and keyFile paths to point to /ssl/cert.cer, etc...

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