首页 > 解决方案 > 404 错误:无法使用 Docker 访问 Traefik 仪表板

问题描述

我无法访问 Traefik 仪表板。我尝试使用 localhost 和给定的 Docker IP 地址 192.168.99:3000 只是它导致 404 错误页面。我所有的其他服务都在工作。

码头工人-compose.yml

version: "3.3"

networks:
    # Allow the use of traefik in other docker-compose.yml files
    traefik:
        external: true

services:

  traefik:
    image: "traefik:v2.2"
    container_name: "traefik"
    logging:
      options:
        max-size: "10m"
        max-file: "3"
    command:
      # Only for development environment
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      # Get Docker as the provider
      - "--providers.docker=true"
      # Avoid that all containers are exposed
      - "--providers.docker.exposedbydefault=false"
      # Settle the ports for the entry points
      - "--entrypoints.web.address=:3000"
      # Settle the autentification method to http challenge
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge=true"
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web"
      # Uncomment this to get a fake certificate when testing
      #- "--certificatesresolvers.myhttpchallenge.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      # Settle letsencrypt as the certificate provider
      - "--certificatesresolvers.myhttpchallenge.acme.email=me@mail.com"
      - "--certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "3000:3000"
    networks:
      - "traefik"
    labels:
      traefik.frontend.rule: 'Host:web.localhost'

    volumes:
      # Store certificates in ./letsencrypt/acme.json
      - "./letsencrypt:/letsencrypt"
      # Connect to Doker socket
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

当我运行 docker-compose up -d 时,Traefik 加载正常,但我无法访问仪表板。有人请帮我指出正确的方向。谢谢。

标签: dockerdocker-composelocalhosttraefik

解决方案


推荐阅读