gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 18:43:54 26 4
gpt4 key购买 nike

我正在尝试在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com