0

I am trying to setup Traefik with a test app on a non-standard port. IIS is currently using port 80 on my machine so I am using port 9000 for my test app. I keep getting back Bad Gateway. The test application is an empty .net core application with a welcome page

From the Bad Gateway response I assume that Traefik is not routing the request correctly or that the container is not picking up the request. I have tried numerous traefik labels and cannot still get the request to oute correctly. I can access the Traefik dashboard on docker.localhost:8080 But if I access my app on webapp3.localhost:9000 I get a "Bad Request"

docker-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
Mohamed Cassim
  • 153
  • 1
  • 10
  • Please run the following for the container id (`$cid`) of your webapp3 container and update your question with the output: `docker run -it --rm --net container:$cid nicolaka/netshoot ss -lnt` – BMitch May 27 '19 at 14:42
  • For webapp3 container: Local Address:Port - 127.0.0.11:38683 Peer Address:Port - 0.0.0.0: * For traefik container: Local Address:Port - 127.0.0.11:43457 Local Address:Port - * :8080 Local Address:Port - * :80 Peer Address:Port - 0.0.0.0: * Peer Address:Port - * : * Peer Address:Port - * : * – Mohamed Cassim May 27 '19 at 15:05
  • 1
    There does not appear to be any welcome page listening on your web app on port 80 inside the container. This appears to be a .Net issue, not a docker, traefik, or bad gateway issue. – BMitch May 27 '19 at 15:09
  • Thanks. That command put me in the right direction. Turns out the docker-compose.overrides.yml was being ignored in the docker compose steps. Thereby not registering the required ports to be listened to – Mohamed Cassim May 28 '19 at 14:12

0 Answers0