首页 > 解决方案 > Traefik v2.5 未重定向到搬运工容器。404 未找到

问题描述

我正在尝试让 traefik 与 portainer 一起工作,但到目前为止还没有。我的目标是输入http://localhost/portainer并让 traefik 重定向到 portainer 门户。

到目前为止,我的 docker-compose 看起来像这样:

services:
  reverse-proxy:
    image: traefik
    container_name: "traefik"
    networks:
      - traefik_net
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./traefik.yml:/traefik.yml:ro"

  portainer:
    image: "portainer/portainer-ce"
    container_name: "portainer"
    networks:
      - traefik_net
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - portainer_data:/data"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.portainer.entrypoints=web"
      - "traefik.http.routers.portainer.rule=Host(`localhost`) && PathPrefix(`/portainer`)"
      - "traefik.http.services.portainer.loadbalancer.server.port=9000"
networks:
  traefik_net: {}
volumes:
  portainer_data:

我的 traefik.yml 文件是:

log:
  level: INFO

api:
  insecure: true
  dashboard: true

entryPoints:
  web:
    address: ":80"

providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false

我真的不知道发生了什么事。当我尝试连接时,http://localhost/portainer我得到404 not found.

仪表板工作正常。当我检查 portainer 服务是否具有 portainer 容器的 docker ip 以及端口 9000 时,所以我认为问题在于 traefik 接收并将 url 重定向到 portainer 容器。

欢迎任何帮助,谢谢。

标签: dockerhttp-status-code-404traefikportainer

解决方案


Portainer 还不支持子路径,​​你可以在这里提出请求https://github.com/porttainer/portainer/issues?q=is%3Aissue+is%3Aopen


推荐阅读