首页 > 解决方案 > 无法使用 traefik 的仪表板绑定到端口 8080

问题描述

我有以下 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)

我能错过什么?

标签: dockertraefik

解决方案


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


推荐阅读