I've seen many traefik examples specifying the docker network, and then respecifying it in traefik's static/dynamic config as well as in service containers.
docker-compose.yml:
networks:
traefik:
name: traefik
services:
traefik:
image: traefik
# ...
networks:
- traefik
command:
- --providers.docker.network=traefik # <--- necessary?
whoami:
image: traefik/whoami
# ...
networks:
- traefik
labels:
traefik.docker.network: traefik # <--- necessary?
For me it works without those commented lines.
Are they necessary? Why do those settings exist?