我正在尝试学习和使用traefik。 这是我的docker-compose.yaml:
version: "3"
services:
traefik:
image: "traefik:v2.0"
container_name: "traefik"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- ./traefik:/etc/traefik
- ./docker:/etc/docker
whoami:
image: "containous/whoami"
container_name: "whoami"
这是我的traefik.toml:
[entryPoints]
[entryPoints.web]
address = ":80"
[providers]
[providers.file]
filename = "/etc/docker/dynamic_conf.toml"
[providers.docker]
exposedByDefault = false
[api]
insecure = true
这是我的dynamic_conf.toml:
[http]
[http.routers]
[http.routers.whoami]
rule = "Host(`whoami.localhost`)"
entrypoints = "web"
service = "whoami"
但是当我构建图像并运行它时,出现错误:
Cannot start the provider *file.Provider: toml: cannot load TOML value of type string into a Go slice
屏幕截图:traefik errors
我找不到原因,我搜索并更改了
filename = "/etc/docker/dynamic_conf.toml"
到
filename = ["/etc/docker/dynamic_conf.toml"]