Beginner try to configure traefik

Hi,
I start with traefik last week, but I still have problem to acces to service.
I have create a docker-compose file with traefik and whoami.
I can acces to traefik dashboard but not to whoami.
I have installed docker on virtual machine (srvdocker). the domain name comes from the dns in the internet router (free.box)
http://srvdocker.free.box/dashboard/#/ works
http://whoami.srvdocker.free.box/ do not work

here is the docker-compose.yml

version: "3"

services:
  traefik:
    image: traefik:v2.2
    ports:
      - "80:80"
      - "443:443"
    command:
      - --entryPoints.web.address=:80
      - --entryPoints.websecure.address=:443
      - --api
      - --providers.docker.exposedByDefault=false
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.http_traefik.service=api@internal"
      - "traefik.http.routers.http_traefik.rule=Host(`srvdocker.free.box`)"
      - "traefik.http.routers.http_traefik.entrypoints=web"

  whoami:
    image: containous/whoami:v1.3.0
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami_http.rule=Host(`whoami.srvdocker.free.box`)"
      - "traefik.http.routers.whoami_http.entrypoints=web"

It looks like an incredibly simple setup. What error are you getting ?
Are you certain the DNS is resolving correctly?

On any remote PC I can ping srvdocker.free.box
so, I supose it is working

Please not I don't really have a DSN server. I have a Internet router that have a DHCP server. My virtual server srvdocker (Ubuntu 18.04) get his IP from this DHCP and automatic domain name from this routeur (free.box).

A ping is not something that Traefik would respond to. Ping uses ICMP which is not a protocol that traefik supports(TCP,UDP,HTTP).

Again. What error are you getting?

The name you get from the provider is fine, assuming it resolves on the internet. Even if it doesn't you can use different rules for your Traefik routes.

I just try to reach http://whoami.srvdocker.free.box/ and nothing happend
If I use http://srvdocker.free.box/whoami then I get this message : 404 page not found

You mentioned that srvdocker.free.box is automatically generated for you, how is whoami.srvdocker.free.box generated.

It would need to be a resolvable address. dig whoami.srvdocker.free.box and see if an address is returned.

404 is better, it means traefik is reachable at srvdocker.free.box. But your Traefik router rules are not configured to handle /whoami. If you update the whoami_http rule to (Host(`srvdocker.free.box`) && PathPrefix(`/whoami`)) then you request should reach the whoami container.

this works: (Host(srvdocker.free.box) && PathPrefix(/whoami))

dig whoami.srvdocker.free.box : no address returned
dig srvdocker.free.box : address is returned

what should I do, if I want to use some thing like
whoami.srvdocker.free.box
or
whoami.free.box

Usually you would register the fqdn in your domain registrar. You may be able to register additional hostnames with your hosting provider.