0

我正在尝试在非标准端口上使用测试应用程序设置 Traefik。IIS 当前在我的机器上使用端口 80,因此我将端口 9000 用于我的测试应用程序。我不断回到坏网关。测试应用程序是一个带有欢迎页面的空 .net 核心应用程序

从 Bad Gateway 响应中,我假设 Traefik 没有正确路由请求,或者容器没有接收请求。我已经尝试了许多 traefik 标签,但仍然无法正确发出请求。我可以在 docker.localhost:8080 上访问 Traefik 仪表板但是如果我在 webapp3.localhost:9000 上访问我的应用程序,我会收到“错误请求”

码头工人-compose.yml

version: '3.4'

services:
  webapp3:
    container_name: webapp3
    image: ${DOCKER_REGISTRY-}webapp3
    build:
      context: .
      dockerfile: WebApp3/Dockerfile
    networks:
      - web
    labels:
      - "traefik.backend=webapp3"
      - "traefik.enable=true"
      - "traefik.docker.network=web"
      - "traefik.frontend.rule=Host:webapp3.localhost"
      - "traefik.port=80"

  traefik:
    container_name: traefik
    image: traefik
    command: --api --docker --logLevel=DEBUG
    restart: always
    ports:
      - "443:443"
      - "9000:80"
      - "8080:8080"
    volumes:
      - ./docker/traefik:/etc/traefik/
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /dev/null:/traefik.toml
    networks:
      - web
    labels:
      - "traefik.enable=true"
      - "traefik.backend=traefik"
      - "traefik.frontend.rule=Host:docker.localhost"
      - "traefik.port=8080"
      - "traefik.docker.network=web"

networks:
  web:
    external : true

docker-compose.override.yml

version: '3.4'

services:
  webapp3:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80;http://+:9000
    volumes:
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
4

0 回答 0