Search code examples
dockerdocker-composetraefik

Traefik is not loading my config file at all


As the title says my traefik container is not loading my config file. I have a folder with my docker-compose.yml and my traefik.yml. According to the traefik documentation traefik will automatically search for a file with this name in the working directory but it does not load it.

My docker-compose.yml:

version: '3.3'

services: 
  traefik:
  image: traefik
  ports:
    - 8080:8080
    - 80:80
    - 443:443

and my traefik.yml:

api:
  dashboard: true
  insecure: true

entryPoints:
  web:
    address: ":80"
  websecure:
    address: ":443"

I expect that the dashboard is avalible under localhost:8080 and that it shows my entrypoints.

I hope that you can help me. Thank you.


Solution

  • Ok so after looking at some other examples it seems that you can mount your config files to the container using volumes and it will work absolutely fine.

    Please have a look at the configuration below docker-compose.yml:

    version: '3.3'
    
    services: 
      traefik:
        image: traefik
        ports:
          - 8080:8080
          - 80:80
          - 443:443
        volumes:
          - ./traefik.yaml:/etc/traefik/traefik.yaml