docker - 使用 traefik 2.0 部署 docker servce 到 swarm
问题描述
我有一个 docker swarm,其网络名称为:traefik-net 类型:覆盖范围:swarm
然后我有一个 docker compose 可以工作。
services:
angularDocs:
image: artifactory.company.com/containers/angular-docs:branchName
networks:
- traefik-net
labels:
- "traefik.http.routers.angularDocs.rule=Host(`branchName.angular.swarm.company.com`)"
- "traefik.http.services.angularDocs.loadbalancer.server.port=80"
networks:
traefik-net:
external: true
´´´
But instead of creating a compose file for each container image. I would like to do
docker service create --options artifactory.company.com/containers/angular-docs:branchName
但是当我这样尝试时,它不适用于 traefik
docker service create --name angulardocs --label "traefik.http.routers.angulardocs.rule=Host(`branchName.angular.swarm.company.com`)" --label "traefik.http.services.angulardocs.loadbalancer.server.port=80" --network traefik-net artifactory.company.com/containers/angular-docs:branchName
在 traefik 2.0 我得到了一条路线
主机(angulardocs-1-egyumq4nfke1lz3ohya38mwsj
)
而不是主机(v8.angular.company.com
)
与标签位于撰写文件中时相比,标签配置错误。
我希望有人有答案。
解决方案
也许你失去了一个“入口点”。如下所示:
- "traefik.http.routers.angularDocs.entrypoints=http # I don't know your entrypoints name
推荐阅读
- javascript - 如何循环对象并将键值推送到键值对象中
- hibernate - 错误:org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Exhausted Resultset,嘿,我的休眠代码中出现了这个异常?
- javascript - Express.js 应用程序错误:表单字段值不持久
- r - 带有对象变量的间接访问列名
- c++ - 堆栈操作(主函数)
- c# - SciChart 在插入新轴时抛出异常
- oracle - oracle 使用 sys refcursor 批量收集限制子句执行详细信息
- ubuntu - 如何在 Windows 10 中从 Ubuntu 应用程序访问 Google Drive 文件夹
- android - 如何在 ion-select-option 中动态设置默认值
- python - 如何解决 Visual Studio 中的 PIL 和 Pillow 问题?