Katacode Traefik 教程报错-container not created

Katacode Traefik tutorial error - container not created

我正在尝试 Katacoda playground 使用 Traefik 的负载平衡容器 - https://www.katacoda.com/courses/traefik/deploy-load-balancer:

这里是教程中用于启动 Traefik 节点和 2 个测试容器的确切 Docker compose 脚本:

  image: traefik
  command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
  ports:
    - "80:80"
    - "8080:8080"
    - "443:443"
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - /dev/null:/traefik.toml

machine:
  image: katacoda/docker-http-server
  labels:
    - "traefik.backend=machine-echo"
    - "traefik.frontend.rule=Host:machine-echo.example.com"

echo:
  image: katacoda/docker-http-server:v2
  labels:
    - "traefik.backend=echo"
    - "traefik.frontend.rule=Host:echo-echo.example.com"

I 运行 Docker-编写命令,如教程中给出:

$ docker-compose up -d
Creating tutorial_traefik_1 ... done
Creating tutorial_echo_1    ... done
Creating tutorial_machine_1 ... done

但是,当我查看容器列表时,我发现只创建了 2 个容器。未创建 Traefik 容器:

$ docker container ls
CONTAINER ID        IMAGE                            COMMAND             CREATED             STATUS              PORTS               NAMES
35e87a3ff6ed        katacoda/docker-http-server      "/app"              11 seconds ago      Up 9 seconds        80/tcp              tutorial_machine_1
a455019d16be        katacoda/docker-http-server:v2   "/app"              11 seconds ago      Up 9 seconds        80/tcp              tutorial_echo_1 

下一步也失败了。这可能是因为Traefik容器不是运行ning:

$ curl -H Host:machine-echo.example.com http://host01
curl: (7) Failed to connect to host01 port 80: Connection refused

任何人都可以复制本教程,请告诉我错误的原因并修复此错误?

今天就运行,你必须硬编码traefik版本到1.7.32

traefik:
  image: traefik:1.7.32
  command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
  ports:
    - "80:80"
    - "8080:8080"
    - "443:443"
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - /dev/null:/traefik.toml

machine:
  image: katacoda/docker-http-server
  labels:
    - "traefik.backend=machine-echo"
    - "traefik.frontend.rule=Host:machine-echo.example.com"

echo:
  image: katacoda/docker-http-server:v2
  labels:
    - "traefik.backend=echo"
    - "traefik.frontend.rule=Host:echo-echo.example.com"