我目前正在尝试让 traefik 在单个容器上使用多个路由器和服务,但它不起作用,我不知道这是否是有意为之。
为什么?
具体来说,我正在使用 gitlab 综合容器,并希望在综合容器内使用/访问多个服务,因为 gitlab 不仅提供“gitlab 网站”。
我尝试了什么?
我只是尝试通过标签将另一个路由器添加到我的 docker compose 文件中
这就是我所拥有的:
labels:
- "traefik.http.routers.gitlab.rule=Host(`gitlab.example.com`)"
- "traefik.http.services.gitlab.loadbalancer.server.port=80"
Run Code Online (Sandbox Code Playgroud)
这就是我要的:
labels:
- "traefik.http.routers.gitlab.rule=Host(`gitlab.example.com`)"
- "traefik.http.services.gitlab.loadbalancer.server.port=80"
- "traefik.http.routers.registry.rule=Host(`registry.gitlab.example.com`)"
- "traefik.http.services.registry.loadbalancer.server.port=5000"
Run Code Online (Sandbox Code Playgroud)
这是行不通的,因为 traefik 可能对路由到哪个服务的内容感到困惑,而且我找不到一种机制可以告诉 traefik 在这种情况下确切地告诉 traefik 哪个路由器转到哪个服务。
这甚至可能还是我只是缺少一点traefik魔术?
我最近遇到了一些奇怪的东西,我不想与你分享,也许有人知道为什么会这样.
因为我没有足够的代表我需要链接截图:
均匀 - 无间距

奇数 - 间距

如您所见,没有边距,填充或其他一些间距定义,浏览器知道这一点.但仍然有这种奇怪的间距,我绝对不知道为什么.
减:
@grd-height : 110px;
@grd-width : @grd-height;
@grd-per-line: 4;
.grd {
width: (@grd-width * @grd-per-line) + 15%;
.data {
display: inline-flex;
height: @grd-height;
width: @grd-width;
padding: 0px;
}
.data:nth-child(even) {
background: #eee;
}
}
Run Code Online (Sandbox Code Playgroud)
(我把15%放在那里为我的测试解决这个问题)
HTML:
<body>
<section class='grd'>
<section class='data'>hello world</section>
<section class='data'>what</section>
<section class='data'>are </section>
<section class='data'>you doing</section>
<section class='data'>hello world</section>
<section class='data'>what</section>
<section class='data'>are </section>
<section class='data'>you doing</section>
<section class='data'>hello world</section>
<section class='data'>what</section>
<section class='data'>are </section>
<section class='data'>you …Run Code Online (Sandbox Code Playgroud)