How to bind subdomains to specific ports

I have docker compose file like:

version: '3.7'

services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.2
    # Enables the web UI and tells Traefik to listen to docker
    command: --api.insecure=true --providers.docker
    ports:
      # The HTTP port
      - "80:80"
      # The Web UI (enabled by --api.insecure=true)
      - "8080:8080"
    volumes:
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - intranet


  whoami-1:
    networks:
      - intranet
    # A container that exposes an API to show its IP address
    image: containous/whoami
    ports:
      - "5001:80"
    labels:
      - "traefik.http.routers.whoami-1.rule=Host(`whoami-1.localhost`)"

  whoami-2:
    networks:
      - intranet
    # A container that exposes an API to show its IP address
    image: containous/whoami
    ports:
      - "5002:80"
    labels:
      - "traefik.http.routers.whoami-2.rule=Host(`whoami-2.localhost`)"


  whoami-3:
    networks:
      - intranet
    # A container that exposes an API to show its IP address
    image: containous/whoami
    ports:
      - "5003:80"
    labels:
      - "traefik.http.routers.whoami-3.rule=Host(`whoami-3.localhost`)"


networks:
  intranet:
    driver: bridge

and Im trying to get:

  • whoami-1.localhost -> 5001 port
  • whoami-2.localhost -> 5002 port
  • whoami-3.localhost -> 5003 port

Can someone give me advice please how to implement that in traefik v2?