【发布时间】:2019-09-22 21:41:27
【问题描述】:
我打算使用 Traefik v2.0 版本,因此首先测试了一些东西。如果我想使用 Swarm 模式,我总是会得到以下日志条目:
time="2019-09-22T21:30:28Z" level=error msg="Provider connection error Cannot connect to the Docker daemon at tcp://127.0.0.1:2377. Is the docker daemon running?, retrying in 507.606314ms" providerName=docker
time="2019-09-23T05:58:39Z" level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at tcp://127.0.0.1:2377. Is the docker daemon running?" providerName=docker
我的 docker.yml 文件:
version: '3.5'
services:
reverse-proxy:
image: traefik:v2.0
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik:/etc/traefik
我的 traefik.toml 文件:
[providers]
[providers.docker]
endpoint = "tcp://127.0.0.1:2377"
swarmMode = true
watch = true
[api]
insecure = true
[log]
level = "DEBUG"
端口:
$ sudo lsof -i -P -n | grep LISTEND
dockerd 501 root 24u IPv6 858243 0t0 TCP *:2377 (LISTEN)
dockerd 501 root 30u IPv6 858280 0t0 TCP *:7946 (LISTEN)
dockerd 501 root 40u IPv6 1024853 0t0 TCP *:80 (LISTEN)
dockerd 501 root 58u IPv6 1024882 0t0 TCP *:8080 (LISTEN)
sshd 510 root 3u IPv4 13105 0t0 TCP *:22 (LISTEN)
sshd 510 root 4u IPv6 13115 0t0 TCP *:22 (LISTEN)
glusterd 514 root 10u IPv4 13127 0t0 TCP *:24007 (LISTEN)
【问题讨论】:
-
不要混合
traefik.toml、环境变量和命令行,不支持。endpoint = "tcp://127.0.0.1:2377"仅在您的 docker swarm 管理器侦听127.0.0.1上的端口2377时才有效。我建议你把这条线注释掉。最后,whoami 不听8080 -
我已经删除了命令行变量,没有正面结果。
-
我建议您可能想要进行所有更改。
-
问题不在于 whoami,我无法访问 traefik 仪表板。
-
我听到了。您需要对我在第一条评论中建议的所有内容进行更改才能取得进展。