在Docker Windows容器上运行Traefik

在Docker Windows容器上运行Traefik,docker,traefik,Docker,Traefik,我尝试在Windows本机容器上的docker上运行Traefik,但没有找到任何示例。我只想用whoami运行入门示例。 我尝试了很多参数,但都没有成功。我有两个问题: 如何通过Windows容器传递traefik的配置文件?(绑定文件在Windows上不起作用) 如何使用命名管道连接到docker主机 我尝试过的docker compose示例: version: '3.7' services: reverse-proxy: image: traefik:v1.7

我尝试在Windows本机容器上的docker上运行Traefik,但没有找到任何示例。我只想用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,build e68fc7a,Docker compose版本1.22.0,build f46880fe

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


谢谢您的帮助。

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