Error file Provider Traefik 2

Hi,

I not locate the solution form my problema.

I add a filenale configuration extra , and i appear this error:
msg="Cannot start the provider *file.Provider: error reading configuration file: /etc/traefik/dyn-config.yml - open /etc/traefik/dyn-config.yml: no such file or directory"

in the traefik.yml i put this:

api:
  insecure: true
  dashboard: true


global:
  checkNewVersion: true
  sendAnonymousUsage: false

entryPoints:
  http:
    address: ":80"
  https:
    address: ":443"

certificatesResolvers:
  http:
    acme:
      email: miemail@utlook.com
      storage: acme.json
      httpChallenge:
        entryPoint: http


providers:
  docker:
    exposedByDefault: false
  file:
    filename: /etc/traefik/dyn-config.yml
    watch: true

in the dyn-config file:

http:
  services:
    homeAssistant:
      loadBalancer:
        servers:
          - url: "http://192.168.0.5:8123"

  routers:
    ha-http:
      entryPoints:
        - http
      service: homeAssistant
      middlewares:
        - redirect
      rule: "Host(`domain.subdomain.com`)"
    ha-https:
      entryPoints:
        - https
      service: homeAssistant
      rule: "Host(`domain.subdomain.com`)"
      tls:
        certResolver:

  middlewares:
    redirect:
      redirectScheme:
        scheme: https

Where is the problem???

Hello,

the error is that /etc/traefik/dyn-config.yml doesn't exist.

the file exist!. i checked

the error is clear.

How do you start your Traefik? Are you using Docker? Have you mount the file in the right directory?

Yes, i use docker read this guide, https://medium.com/@containeroo/traefik-2-0-route-external-services-through-traefik-7bf2d56b1057

( i changed the name files) i need use for route external devices.

Sorry i'm very noob

The config local in local docker is ok

this is my docker-compose of traefik

version: '3'

services:
  traefik:
    image: traefik:v2.1.8
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./data/traefik.yml:/traefik.yml:ro
      - ./data/acme.json:/acme.json
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`domain.domain.com`)"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=traf:$$apq$$qKGYqAok8RWK.Vlb26IfC0"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`domain.domain.com`)"
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=http"
      - "traefik.http.routers.traefik-secure.service=api@internal"

networks:
  proxy:
    external: true

Your file is not mounted.

version: '3'

services:
  traefik:
    image: traefik:v2.1.8
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./data/traefik.yml:/traefik.yml:ro
      - ./data/acme.json:/acme.json
      - ./data/dyn-config.yml/etc/traefik/dyn-config.yml # <--------------
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`domain.domain.com`)"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=traf:$$apq$$qKGYqAok8RWK.Vlb26IfC0"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`domain.domain.com`)"
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=http"
      - "traefik.http.routers.traefik-secure.service=api@internal"

networks:
  proxy:
    external: true

i add:

- ./data/dyn-config.yml:/etc/traefik/dyn-config.yml

Cannot start the provider *file.Provider: error reading configuration file: /etc/traefik/dyn-config.yml - read /etc/traefik/dyn-config.yml: is a directory"

sorry is solved i created "directory" not file :slight_smile:

Very thx by your help