我需要在Traefik后面运行两个相同的容器,这些容器必须接受来自多个端口的请求。 为此,我使用码头服务标签 。 我遇到的问题是当我使用Docker服务标签并尝试扩展到两个容器时,我收到有关已经定义的后端的错误消息。
使用普通标签( traefik.frontend , traefik.port等)工作正常,但添加额外的标签( traefik.whoami.frontend , traefik.whoami.port等)似乎打破了局面。
Docker撰写文件:
version: '2' services: whoami: image: emilevauge/whoami networks: - web labels: - "traefik.http.frontend.rule=Host:whoami.docker.localhost" - "traefik.http.port=80" - "traefik.http.frontend.entryPoints=http" - "traefik.http.frontend.backend=whoami" - "traefik.soap.frontend.rule=Host:whoami.docker.localhost" - "traefik.soap.port=8443" - "traefik.soap.frontend.entryPoints=soap" - "traefik.soap.frontend.backend=whoami" networks: web: external: name: traefik_webgateway放大:
$ docker-compose scale whoami=2 Creating and starting whoami_whoami_2 ... doneTraefik错误日志:
proxy_1 | time="2017-10-23T15:37:16Z" level=error msg="Near line 39 (last key parsed 'backends.backend-whoami.servers'): Key 'backends.backend-whoami.servers.service' has already been defined."任何人都可以告诉我这里我做错了什么,或者是否有另一种方法将两个端口映射到容器?
谢谢!
I need to run two identical containers behind Traefik which have to accept requests coming in on multiple ports. To do this I am using docker service labels. The problem that I am running into is when I use Docker service labels and try to scale up to two containers I get an error message about the backend already being defined.
Using the normal labels (traefik.frontend, traefik.port etc.) works fine, but adding the extra labels (traefik.whoami.frontend, traefik.whoami.port etc.) seems to break things.
Docker compose file:
version: '2' services: whoami: image: emilevauge/whoami networks: - web labels: - "traefik.http.frontend.rule=Host:whoami.docker.localhost" - "traefik.http.port=80" - "traefik.http.frontend.entryPoints=http" - "traefik.http.frontend.backend=whoami" - "traefik.soap.frontend.rule=Host:whoami.docker.localhost" - "traefik.soap.port=8443" - "traefik.soap.frontend.entryPoints=soap" - "traefik.soap.frontend.backend=whoami" networks: web: external: name: traefik_webgatewayScale up:
$ docker-compose scale whoami=2 Creating and starting whoami_whoami_2 ... doneTraefik error log:
proxy_1 | time="2017-10-23T15:37:16Z" level=error msg="Near line 39 (last key parsed 'backends.backend-whoami.servers'): Key 'backends.backend-whoami.servers.service' has already been defined."Can anyone tell me what I'm doing wrong here or if there is another way to map two ports to a container?
Thanks!
最满意答案
Docker副本管理存在一个错误。
修复程序将在下一个版本中合并: https : //github.com/containous/traefik/pull/2314 。
There was a bug with Docker replicas management.
A fix will be merged in the next release : https://github.com/containous/traefik/pull/2314.
更多推荐
发布评论