Traefik v2.5未重定向到端口容器。未找到404

人气:233 发布:2022-10-16 标签: http-status-code-404 docker traefik portainer

问题描述

我正在试着让traefik和肖像一起工作,但到目前为止还没有。 我的目标是只需键入http://localhost/portainer并让traefik重定向到肖像门户。

到目前为止,我的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

仪表板工作正常。当我检查搬运工服务是否有搬运工容器的码头IP和端口9000时,我认为问题出在traefik接收并将URL重定向到搬运工容器。

欢迎任何帮助,谢谢。

推荐答案

Portainer尚不支持子路径,您可以在此处提出请求https://github.com/portainer/portainer/issues?q=is%3Aissue+is%3Aopen

518