docker - 在 Docker Windows 容器上运行 Traefik

标签 docker traefik

我尝试在 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/

相关文章:

node.js - Docker 和 Nginx 解析错误的 IP 地址

docker - 无法使用 traefik 的仪表板绑定(bind)到端口 8080

ruby-on-rails - 无法与docker-compose同步文件

nginx - Nginx不与我的dockers容器一起运行

docker - 即使build命令相同,docker build也会创建另一组docker镜像?

kubernetes - Kubernetes 上的 Traefik v2.0 自签名证书

nginx - 如何修复 Kubernetes Ingress Controller 从集群中切断节点的问题

ssl - 为 Traefik 推荐的 TLS 密码

kubernetes - 在Vagrant下使用Kubernetes公开用于主机的Traefik Web UI

node.js - 从主机在Docker容器上运行命令