I am trying to isolate static and dynamic configuration to be in separate files. Here are the files that I use:
docker-compose-traefik.yml
version: "3.7"
services:
traefik:
image: "traefik:v2.0"
networks:
- traefik-net
ports:
- "80:80"
- "9000:8080"
- "5000:5000"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik.yml:/etc/traefik/traefik.yml"
- "./dynamic_conf.yml:/etc/traefik/dynamic_conf.yml"
networks:
traefik-net:
external:
name: traefik-net
traefik.yml
log:
level: DEBUG
api:
insecure: true
dashboard: true
providers:
file:
filename: dynamic_conf.yml
watch: true
docker:
swarmMode: true
exposedByDefault: false
entrypoints:
web:
address: ":5000"
dynamic_conf.yml
http:
routers:
whoami:
rule: "Host(`example.com`)"
entrypoints: web
service: whoami
services:
whoami:
loadbalancer:
server:
port: 80
sticky:
cookie:
name: StickyCookie
When I run the command...
docker stack deploy -c docker-compose-traefik.yml Traefik
...I get the following error in the logs:
level=error msg="Cannot start the provider *file.Provider: error reading configuration file: dynamic_conf.yml - open dynamic_conf.yml: no such file or directory"
All mentioned files are in the same directory on host.
What am I doing wrong?