【问题标题】:can't bind to port 8080 with traefik's dashboard无法使用 traefik 的仪表板绑定到端口 8080
【发布时间】: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

标签: docker traefik


【解决方案1】:

确保您没有在 docker-compose 文件中为 traefik 命令指定 --api 标志。 CLI 和 toml 配置不能一起工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-21
    • 2018-03-21
    • 2018-05-24
    相关资源
    最近更新 更多