docker - Traefik 2.0 "port is missing"用于内部仪表板

标签 docker traefik swarm

我正在尝试在 docker swarm 模式下使用 traefik 2.0 (!)。这是我的堆栈:

version: '3.7'
services:
  traefik:
    image: traefik:latest
    ports:
      - 80:80
      - 443:443
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.role == manager
        preferences:
          - spread: node.id
      labels:
        - traefik.enable=true
        - traefik.http.routers.traefikRouter.rule=Host(`127.0.0.11`)
        - traefik.http.routers.traefikRouter.service=api@internal
        - traefik.http.routers.traefikRouter.entrypoints=http
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: >
      --providers.docker
      --providers.docker.exposedbydefault=false
      --providers.docker.swarmmode=true
      --entryPoints.http.address=":80"
      --entryPoints.https.address=":443"
      --accesslog
      --log.level=DEBUG
      --api=true
      --api.dashboard=true
    networks:
      - traefik-public

  whoami:
    image: containous/whoami
    deploy:
      replicas: 2
      labels:
        - traefik.enable=true
        - traefik.http.services.whoami.loadbalancer.server.port=80
        - traefik.http.routers.whoami.rule=Host(`127.0.0.12`)
        - traefik.http.routers.whoami.service=whoami
        - traefik.http.routers.whoami.entrypoints=http
    networks:
      - traefik-public

# Run on Host: docker network create --driver=overlay traefik-public
networks:
  traefik-public:
    external: true


访问 http://127.0.0.12/有效,我看到 whoami 页面。
访问 http://127.0.0.11/http://127.0.0.11/dashboard/应该显示 traefiks 内部仪表板,如果我读了 the docs对。但是我得到了 traefiks 404。
docker service log显示一个错误:
level=error msg="port is missing" container=traefik-traefik-z8kz9w91yw7pm6tp5os5vxrnv providerName=docker

有什么问题?我怀疑它缺少服务的端口 api@internal ...但那是它的内部服务 - 我不能配置?!

有任何想法吗?谢谢

最佳答案

好的,只需在标签中添加一个虚拟服务端口即可

      labels:
        - traefik.enable=true
        - traefik.http.services.justAdummyService.loadbalancer.server.port=1337
        - traefik.http.routers.traefikRouter.rule=Host(`127.0.0.11`)
        - traefik.http.routers.traefikRouter.service=api@internal
        - traefik.http.routers.traefikRouter.entrypoints=http

我现在在 traefik 上挣扎了超过 24 小时......这不可能是解决方案,对吧?
猜猜我必须将此报告为错误。有人可以确认这不是它应该如何工作吗?

关于docker - Traefik 2.0 "port is missing"用于内部仪表板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58580782/

相关文章:

ECR 上的 Docker 登录失败,并在 Jenkins 的 Powershell 上出现 400 Bad Request

docker - 使用 docker 运行 hello-world 时如何修复 "ERRO[0005] error waiting for container: context canceled"

通过 docker 的 Rstudio 无法读取/etc/.odbc.ini,只能读取 ~/.odbc.ini

docker - 使用Docker标签时出现Traefik自定义错误页面

docker - Traefik 和自签名 SSL

docker - Traefik的ProxyPass/ProxyPassReverse

docker - 在 traefik 中是否默认启用了 docker swarm 负载均衡器?

Azure Pipeline 与 docker build 一起传递参数不起作用

spring - 在 Docker Swarm 中创建网络

Docker、Traefik 2.2 和默认证书