gpt4 book ai didi

docker - 在 Docker Windows 容器上运行 Traefik

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

我尝试在 Windows native 容器上的 docker 上运行 Traefik,但我没有找到任何示例。我只想用 whoami 运行入门示例。我尝试了很多参数都没有成功。我有两个问题:

  • 如何使用 Windows 容器为 traefik 传递配置文件? (绑定(bind)文件不适用于 Windows)
  • 如何使用命名管道连接到 docker 主机?

我尝试过的 docker compose 示例:

version: '3.7'
services:
reverse-proxy:
image: traefik:v1.7.2-nanoserver # The official Traefik docker image
command: --api --docker --docker.endpoint=npipe:////./pipe/docker_engine # Enables the web UI and tells Træfik to listen to docker
ports:
- "80:80" # The HTTP port
- "8080:8080" # The Web UI (enabled by --api)
volumes:
- source: '\\.\pipe\docker_engine'
target: '\\.\pipe\docker_engine'
type: npipe
whoami:
image: emilevauge/whoami # A container that exposes an API to show its IP address
labels:
- "traefik.frontend.rule=Host:whoami.docker.localhost"

Traefik 仪表板在 8080 上工作正常,但找不到提供程序和 whoami 容器。

我使用的是 Windows 10 1803,Docker 版本 18.06.1-ce,构建 e68fc7a,docker-compose 版本 1.22.0,构建 f46880fe

请注意,如果我在 Windows 上(而不是在容器中)启动 Traefik,它可以正常工作。

谢谢你的帮助。

最佳答案

有一个工作示例 here .如果您想在 swarm 中运行它,请尝试使用 docker network createdocker service create 而不是 docker stack deploy。看我的问题here了解更多详情。

关于docker - 在 Docker Windows 容器上运行 Traefik,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52759372/

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