I am trying to control internet access in my containers and that I am doing with internal: true set for my traefik network. However, I noticed that port detection fails to work with the introduction of the internal config.
Here is a minimal reproducible example:
services:
traefik:
image: "traefik:v3.4"
container_name: "traefik"
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entryPoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- traefik
whoami:
image: "traefik/whoami"
container_name: "simple-service"
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
- "traefik.http.routers.whoami.entrypoints=web"
networks:
- traefik
expose:
- 80
networks:
traefik:
name: traefik
driver: bridge
internal: true # Comment this and it works.
attachable: false
My question is, what do I need to do to ensure that port detection works even on an internal network?