Can not resole host when i use traefik

hi.
On my rasberry there runs a docker service.
I'm using portainer to manage my container. But i install everything by docker-compose.yml

Here is my file :

version: '3'

services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: always
    ports:
      - "9000:9000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /home/pi/docker/volumes/portainer:/data:rw

  traefik:
    image: traefik:latest
    container_name: traefik
    command:
      - --api=true
      - --api.dashboard=true
      - --api.insecure=true
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --log=true
      - --log.level=INFO
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule=Host(`traefik.local`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.entrypoints=web"
    networks:
      - traefik
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /home/pi/docker/volumes/traefik/acme.json:/acme.json

  grafana:
    image: grafana/grafana
    container_name: grafana
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.grafana.rule=Host(`grafana.rasberry.me`)"
      - "traefik.http.services.grafana.loadbalancer.server.port=3000"
      - "traefik.http.routers.grafana.entrypoints=web"
      - "traefik.port=3000"
    volumes:
      - /home/pi/docker/volumes/grafana:/var/lib/grafana:rw
    restart: always
    user: "${UID}:${GID}"
    depends_on:
      - traefik

networks:
  traefik:
    external: true```


My Goal is to reach grafana service in this way : 
grafana.rasberry.me

But I got curl: (6) Could not resolve host: grafana.raspberry.me

You need to create a DNS entry that resolves the domain to the according IP.

When you just want that to work on only one machine, you can use a hosts file. When it should work in your whole home network, then you need to setup your (DSL?) router with the DNS.

Thank you for your fast response. Yes I want to use in my hole network
I'm using a fritz box. Do you know how to modify my router DNS

The hostname of my rasberry is rasberry-docker
Could a be a solution to config prefix in trafik so that i can call rasbery-docker/grafana

In FritzBox you can for sure set a local (sub-)domain name for a device.

Yes that is possible - but i have to config this for every service !?

Would i get the same result if i use a suffix like that - "traefik.http.routers.grafana.rule=Host(raspberry-docker) && Path(/grafana)"

Usually web-apps are not path-aware, but use a fixed path. You can use PathPrefix() and StripPrefix middleware for the request, but the web-app might respond with fixed paths in redirect and links (js, img), like /login and /script, which will not work.

It’s best practice to use sub-domains for web-apps. You can only use PathPrefix() with a web-app if it has some kind of „base path“ setting.

So new day new luck :wink:
I was thinking about your idea with sub domains.

Perhaps I have to say something about my setup or my goal :
I have a rapsberry pi where are many services : e.g grafana, pihole ....

Currently each container expose the nessarry ports. So I can reach my grafana Dashboard like this :
http://raspberry-docker:3000

That works fine. But I want to reach it this way : grafana.raspberry-docker.me (for example)

But My Browser send the grafana.raspberry-docker.me request to the router but it coukd find a DNS response for this URL.
So my question is : When i configure my fritz.box with Rebimd DNS protection , I have to add each URL like this grafana.raspberry-docker.me.

But why should this work.