How to Configure Traefik to Use Existing TLS Certificates

1. Create a new file ```tls.yml```

```
tls:
  stores:
    default:
      defaultCertificate:
        certFile: /etc/traefik/certs/your-domain.dev/cert.pem
        keyFile: /etc/traefik/certs/your-domain.dev/privkey.pem
```

2. Make sure you're copying this file in your ```Dockerfile```

```COPY .docker/traefik/conf.d/tls.yml /etc/traefik/tls.yml```

3. Mount the ```certs``` folder in your ```docker-compose.yml``` file

```
volumes:
  ...
	- .docker/traefik/certs:/etc/traefik/certs
  ...
```

4. Update the ```traefik.yml``` config to support the ```file``` provider: 

```
providers:
		...
    file:
      filename: "/etc/traefik/tls.yml
    ...
```

Nick Ciolpan
20 Feb 2023
« Back to post