我正在检查Traefik v2的新功能 出于某种原因,我无法从traefik toml conf中设置Providers.Docker变量。
“提供者”下面的值正确,但Providers.Docker被忽略。
我的toml样本文件:
[Global]
Debug = true
CheckNewVersion = true
SendAnonymousUsage = false
[API]
Dashboard = true
[Providers]
ProvidersThrottleDuration = 999
[Providers.Docker]
UseBindPortIP = true
从日志中开始Traefik时,它将转储静态conf:
如您所见,Global,API,已加载提供程序,但是Providers.Docker被忽略了吗?
任何提示我在做什么错吗?
time="2019-04-15T16:02:13Z" level=debug msg="Static configuration loaded
{
"Global": {
"Debug": true,
"CheckNewVersion": true,
"SendAnonymousUsage": false
},
"ServersTransport": {
"InsecureSkipVerify": false,
"RootCAs": null,
"MaxIdleConnsPerHost": 200,
"ForwardingTimeouts": null
},
"EntryPoints": {
"http": {
"Address": ":80",
"Transport": {
"LifeCycle": {
"RequestAcceptGraceTimeout": 0,
"GraceTimeOut": 10000000000
},
"RespondingTimeouts": {
"ReadTimeout": 0,
"WriteTimeout": 0,
"IdleTimeout": 180000000000
}
},
"ProxyProtocol": null,
"ForwardedHeaders": {
"Insecure": false,
"TrustedIPs": null
}
},
"traefik": {
"Address": ":8080",
"Transport": {
"LifeCycle": {
"RequestAcceptGraceTimeout": 0,
"GraceTimeOut": 10000000000
},
"RespondingTimeouts": {
"ReadTimeout": 0,
"WriteTimeout": 0,
"IdleTimeout": 180000000000
}
},
"ProxyProtocol": null,
"ForwardedHeaders": {
"Insecure": false,
"TrustedIPs": null
}
}
},
"Providers": {
"ProvidersThrottleDuration": 999000000000,
"Docker": {
"Constraints": null,
"Watch": true,
"Endpoint": "unix:///var/run/docker.sock",
"DefaultRule": "Host(`{{ normalize .Name }}`)",
"TLS": null,
"ExposedByDefault": true,
"UseBindPortIP": false,
"SwarmMode": false,
"Network": "",
"SwarmModeRefreshSeconds": 15
},
"File": null,
"Marathon": null,
"Kubernetes": null,
"KubernetesCRD": null,
"Rest": null
},
"API": {
"EntryPoint": "traefik",
"Dashboard": true,
"Statistics": null,
"Middlewares": null
},
"Metrics": null,
"Ping": null,
"Log": null,
"AccessLog": null,
"Tracing": null,
"HostResolver": null,
"ACME": null
}
我的docker撰写文件:
version: '2'
networks:
domain:
external:
name: domain
services:
traefik:
image: traefik:v2.0
networks:
- janier
command: --api --providers.docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/traefik/traefik.toml:/etc/traefik/traefik.toml
gogs:
image: gogs/gogs
networks:
- domain
labels:
- "traefik.http.routers.gogs.rule=Host(`gogs.domain`)"
- "traefik.port=3000"
volumes:
- /opt/docker/volume/gogs:/data
答案 0 :(得分:0)
问题与“命令:-api --providers.docker”有关
-providers.docker使用默认设置,并忽略toml配置的docker provider部分。