# Add custom TLS per service

**URL:** <https://community.traefik.io/t/add-custom-tls-per-service/23095>\
**Category:** Traefik v3 (latest)\
**Tags:** docker\
**Created:** [June 7, 2024, 11:34am UTC](https://community.traefik.io/t/add-custom-tls-per-service/23095 "2024-06-07T11:34:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cherry](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@cherry](https://community.traefik.io/u/cherry)\
**Post date:** [June 7, 2024, 11:34am UTC](https://community.traefik.io/t/add-custom-tls-per-service/23095/1 "2024-06-07T11:34:39Z")

</div>

Hi,

I have the following docker-compose file

```auto
version: "3.3"

services:

  traefik:
    image: "traefik:v3.0"
    container_name: "traefik"
    command:
      #- "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entryPoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  starthome:
    image: "ghcr.io/gethomepage/homepage:latest"
    container_name: "homepage"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.starthome.rule=Host(`home.dev.local`)"
      - "traefik.http.routers.starthome.tls=true"
      - "traefik.http.routers.starthome.entrypoints=websecure"
    ports:
      - 3000:6543
    volumes:
      - /path/to/config:/app/config # Make sure your local config directory exists
      - /var/run/docker.sock:/var/run/docker.sock:ro # optional, for docker integrations
    restart: unless-stopped

```

Everything works so far.  
Now I have 2 files for the TLS connection:

```auto
certFile: /path/to/tls/home.dev.local.crt
keyFile: /path/to/tls/home.dev.local.key

```

Now I am trying to add these files to starthome service but thats easy said then done.  
I read different ways to implement this like a dynamic configuration, but no luck so far.

Is it possible to add those TLS files straight into my docker compose yml file?

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 7, 2024, 12:53pm UTC](https://community.traefik.io/t/add-custom-tls-per-service/23095/2 "2024-06-07T12:53:38Z")

</div>

No, you can't define custom TLS certs in compose file. You need an extra file.

You need to define the custom TLS certs in a dynamic config file ([doc](https://doc.traefik.io/traefik/https/tls/#user-defined)) and load it with `providers.file` in static config ([doc](https://doc.traefik.io/traefik/providers/file/#configuration-examples)).
