Hello,
i am runing the latest traefik as a docker container.
My whole setup is good working and everything works fine.
But now I try to attach two networks on a container. As soon as I add the second (not the proxy) network, I got a Bad Gateway when I browse the domain. When I remove it I directly god the success answer from the container.
Here are my configs:
docker-compose from Traefik:
services:
traefik:
image: traefik:v3.1
ports:
- 80:80
- 443:443
networks:
- webproxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- letsencrypt:/letsencrypt
command:
- --api.dashboard=true
- --log.level=DEBUG
- --accesslog=true
- --providers.docker.network=webproxy
- --providers.docker.exposedByDefault=false
- --entrypoints.web.address=:80
- --entrypoints.web.http.redirections.entrypoint.to=websecure
- --entryPoints.web.http.redirections.entrypoint.scheme=https
- --entrypoints.websecure.address=:443
- --entrypoints.websecure.asDefault=true
- --entrypoints.websecure.http.tls.certresolver=myresolver
- --certificatesresolvers.myresolver.acme.email=mail@mail.de
- --certificatesresolvers.myresolver.acme.tlschallenge=true
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
labels:
- traefik.enable=true
- traefik.http.routers.mydashboard.rule=Host(`traefik.domain.de`)
- traefik.http.routers.mydashboard.service=api@internal
- traefik.http.routers.mydashboard.middlewares=traefik-auth
- traefik.http.middlewares.traefik-auth.basicauth.users=xxx"
Here is my docker-compose.yml of the container:
services:
api-report:
image: "ghcr.io/xxx/api-report:latest"
container_name: api-report
networks:
- webproxy
- loki
env_file:
- stack_report_api.env
depends_on:
talmap-db:
condition: service_healthy
labels:
- "traefik.enable=true"
- 'traefik.http.routers.api-report.rule=Host(`report.domain.de`) || Host(`www.report.domainde`)' - "traefik.http.middlewares.mywwwredirect.redirectregex.replacement=https://$$1"
- "traefik.http.services.api-report.loadbalancer.server.port=8001"
- "traefik.docker.network=webproxy" # Specify the network here"
volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
restart: always
networks:
webproxy:
external: true
loki:
external: true
The Problem is, when I add the "loki" to the network-section of the api-report I got bad Gateway when I remove it, all works.
The only entry I see in the Traefik-log:
traefik-1 | 104.28.62.24 - - [28/Oct/2024:11:48:28 +0000] "GET / HTTP/2.0" 502 11 "-" "-" 647 "api-report@docker" "http://172.18.0.8:8001" 0ms
In the other Logs is also no error entry.
I also tried to add
- "traefik.docker.network=webproxy" # Specify the network here"
But this also make no working state.
Some ideas?
EDIT:
Okay I have a little point which I found out:
My Application is bind to one specific ip (the "container-ip", in an .env file I set the ip to the "container-name".) When I change it to 0.0.0.0, all works.
Is this a proper way to do this?