【发布时间】:2018-05-28 16:43:55
【问题描述】:
我有以下 traefik 配置文件:
debug = true
logLevel = "DEBUG"
[entryPoints]
[entryPoints.http]
address = ":80"
compress = true
[entryPoints.dashboard]
address=":81"
[entryPoints.dashboard.auth]
[entryPoints.dashboard.auth.basic]
users = [
"admin:-------"
]
[traefikLog]
[accessLog]
[api]
dashboard = true
entryPoint = "dashboard"
[ping]
[docker]
以及 docker-compose 中的以下路由:
- ‘5080:80’
- ‘5443:443’
- ‘5000:81’
这按预期工作,并且可以从外部通过端口 5000 访问仪表板。
当我将仪表板端口更改为 8080 并将其反映在映射中时出现问题 ('5000:8080')
我收到以下错误:
level=error msg="Error opening listener listen tcp :8080: bind: address already in use"
level=fatal msg="Error preparing server: listen tcp :8080: bind: address already in use"
问题是我没有看到 8080 正在使用中:
[root@ns3106050 ~]# lsof -i -P -n | grep LISTEN
sshd 1276 root 3u IPv4 515 0t0 TCP *:22 (LISTEN)
sshd 1276 root 4u IPv6 517 0t0 TCP *:22 (LISTEN)
dockerd 1277 root 6u IPv6 5955 0t0 TCP *:2376 (LISTEN)
docker-pr 5425 root 4u IPv6 24484 0t0 TCP *:5443 (LISTEN)
docker-pr 5436 root 4u IPv6 24492 0t0 TCP *:5000 (LISTEN)
docker-pr 5447 root 4u IPv6 22391 0t0 TCP *:5080 (LISTEN)
我可能错过了什么?
【问题讨论】:
-
netstat -pant | grep 8080的输出是什么? -
[root@ns3106050 ~]# netstat -pant | grep 8080 -> [root@ns3106050 ~]#
-
它不返回任何东西
-
是在容器内还是在主机上?出现错误是因为您试图将容器内部绑定到正在使用的端口。因此,我们需要在容器内输出
netstat -pant | grep 8080。 -
官方 traefik docker 镜像似乎禁用了 shell