Hello,
I try expose a Port from Docker Container on a Path with Traefik 2:
I use Docker-compose withn Traefik, the Container mm2 run on Port 8088.
I will expose this container under the name localhost/mm2 .
But it doesn't work
Error: 404 Not Found
Publish the Container on a subdomain like mm2.localhost works.
My Config:
Trafik
version: '3'
services:
traefik:
# The official v2 Traefik docker image
image: traefik:v2.2
# Enables the web UI and tells Traefik to listen to docker
command:
#- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
hostname: "traefik"
ports:
# The HTTP port
- "80:80"
- "443:443"
# The Web UI (enabled by --api.insecure=true)
- "58080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
networks:
- default
- adsbnet
Container
mm2:
build: .
tty: true
container_name: mm2
restart: always
hostname: "mm2"
depends_on:
- dump1090m
ports:
- 8088:8088
networks:
- adsbnet
command:
- --inConnectId=dump1090m:30005:ADSB
- --web=8088
volumes:
- /home/pi/adsb/mm2/distances.json:/distances.json
- /home/pi/adsb/mm2/Basestation.sqb:/Basestation.sqb
labels:
- "traefik.enable=true"
- "traefik.http.routers.mm2.rule=(Host(`localhost`) && Path(`/mm2`))" # not Working
#- "traefik.http.routers.mm2.rule=Path(`/mm2`)" # not Working
#- "traefik.http.routers.mm2.rule=Host(`mm2.localhost`)" # Works
- "traefik.docker.network=adsbnet"
- "traefik.http.services.mm2.loadbalancer.server.port=8088"
The whoami with Port 80 und Path works :-(
whoami:
image: "containous/whoami"
container_name: "simple-service"
labels:
- "traefik.enable=true"
- "traefik.docker.network=adsbnet"
- "traefik.http.routers.whoami.rule=Path(`/whoami`)"
- "traefik.http.routers.whoami.entrypoints=web"
networks:
- adsbnet
That's wrong?
Kind Regards
Flightliner