在Docker Windows容器上运行Traefik

3

我想在Windows本地容器上运行Traefik,但我没有找到任何示例。我只想运行Getting Started示例,并使用whoami。我尝试了许多参数,但没有成功。我的两个问题是:

  • 如何通过Windows容器传递Traefik的配置文件?(绑定文件在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(而不是在容器中),它可以正常工作。

感谢您的帮助。

1个回答

3

这里有一个工作示例(链接),如果您想在Swarm上运行它,请尝试使用docker network createdocker service create而不是docker stack deploy。有关更多详细信息,请参见我的问题(链接)


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接