我在 Swarm 中使用 Traefik 时遇到了一些问题。使用以下配置,我希望端口 80 上的流量到达traefik服务,然后将其分派到代理服务上的专用端口,但似乎流量没有通过。
traefik:
image: traefik:1.3.5
command: --web --docker --docker.swarmmode --docker.watch --docker.domain=app.dev --logLevel=DEBUG
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
restart_policy:
condition: on-failure
proxy:
image: 'myapp/proxy'
deploy:
replicas: 1
labels:
- "traefik.backend=proxy"
- "traefik.web.frontend.rule=Host:www.app.dev"
- "traefik.web.port=8000"
- "traefik.wss.frontend.rule=Host:wss.app.dev"
- "traefik.wss.protocol=ws"
- "traefik.wss.port=9002"
- "traefik.api.frontend.rule=Host:api.app.dev"
- "traefik.api.port=8002"
- "traefik.lnr.frontend.rule=Host:lnr.app.dev"
- "traefik.lnr.port=9001"
restart_policy:
condition: on-failure
我在日志中有以下条目:
app_traefik.1.84giy7wqf3n6@moby | time="2017-08-08T11:27:34Z" level=debug msg="Filtering container without port and no traefik.port label app_proxy.1"
当我向应用程序发送请求时收到 404:
curl -H "Host:www.app.dev" http://localhost
404 page not found
在使用 Docker Compose 运行时,是否在 Swarm 的上下文中考虑了单个后端的多端口?
知道我在这里缺少什么吗?