I cannot use WordPress on Docker with Traefik

I noticed some differences between your code and mine. Except for the 'providers.docker.network' string that I added, should the other lines of code be added to my code?
I solved with 'providers.docker.network' and with your way of defining the network.

    image: traefik:v2.8.4

    ports:
      - target: 80
        published: 80
        mode: host
      - target: 443
        published: 443
        mode: host
      - target: 8080
        published: 8080
        mode: host

    networks:
      - proxy

    command:
      - --providers.docker.network=proxy
      - --entrypoints.traefik.address=:8080
      - --certificatesresolvers.leresolver.acme.httpchallenge.entrypoint=web

    volumes:
      - traefik-certificates:/certificates

    labels:
      - traefik.http.routers.dashboard.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)
      - traefik.http.routers.dashboard.entrypoints=traefik

networks:
  proxy:
    name: proxy
    driver: overlay
    attachable: true

volumes:
  traefik-certificates:
    name: traefik-certificates