Hi,
I am totally new to Docker and Traefik, but would like to do a reverse proxy for services inside Docker and using Traefik. After a little success I'm stuck and might only need a little jump start.
I've installed a test VM using Debian 12. Installed Docker (and Docker Compose) on the VM and then Traefik (now 3.x) and whoami as a docker containers through compose file. Looked into the Docker side: listing, starting (docker compose up), stopping the container, changes in the compose file, opening a shell inside Traefik container. Also inspected the Docker networks that got created (automatically) and did an explicit docker network create. Made sure I get output of http://localhost:80/api/rawdata from inside the VM as well as http://:80/api/rawdata from the host on which the VM runs.
After that I created a SABnzbd container (another compose file) and connected this container to the Docker default bridge, the formerly created docker network for Traefik, an new SABNZBD docker network and finally to the Traefik and SABnzbd network. Did a lot of name resolution and ping tests from the shell inside the Traefik and SABnzbd container and from the host. Made sure that the containers can ping each other by IPs and names and that they each have an IP on the same subnet in Docker.
Finally made SABnzbd port available to the outside and tested, that I can reach SABnzbd web page by http
- localhost:8080 from VM
- container-IP:8080 from VM
- VM-IP:8080 from Host of VM
But I didn't succeed in exposing SABnzbd through Traefik. Trying to do so I get 404. The browser address bar changes from /loader to /sabnzbd/wizard though.
Here are my compose files:
services:
traefik:
image: "traefik:latest"
container_name: "traefik"
networks:
- public
- proxy
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8090:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
- "traefik.enable=true"
whoami:
image: "traefik/whoami"
container_name: "traefik-whoami"
networks:
- public
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.entrypoints=web"
networks:
public:
name: public-web
external: true
proxy:
name: internal-proxy
external: true
services:
sabnzbd:
image: lscr.io/linuxserver/sabnzbd:latest
container_name: sabnzbd
restart: unless-stopped
ports:
- 8080:8080
networks:
- proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.sab.rule=PathPrefix(`/loader`)"
- "traefik.http.services.sab.loadbalancer.server.port=8080"
- "traefik.docker.network=proxy"
- "traefik.http.routers.sab.entrypoints=web"
- "traefik.http.middlewares.sab-strip.stripprefix.prefixes=/loader"
- "traefik.http.routers.sab.middlewares=sab-strip"
networks:
proxy:
name: internal-proxy
external: true
Kind regards