title: Traefik v2 listen on port
body: <p>I am using <strong>Traefik v2</strong> with Docker Swarm. I want to achieve the following routing:</p>
  
  <ol>
  <li>mydomain.com:9000 -> Traefik dashboard</li>
  <li>mydomain.com:5000 -> my application</li>
  </ol>
  
  <p><strong>docker-compose-traefik.yml</strong></p>
  
  <pre><code>version: "3.7"
  
  services:
    traefik:
      image: "traefik:v2.0"
      networks:
        - traefik-net
      command:
        - "--log.level=DEBUG"
        - "--api.insecure=true"
        - "--providers.docker.swarmMode=true"
        - "--providers.docker.exposedbydefault=false"
        - "--entrypoints.web.address=:5000"
      ports:
        - "80:80"
        - "9000:8080"
      volumes:
        - "/var/run/docker.sock:/var/run/docker.sock:ro"
  
  networks:
    traefik-net:
      external:
        name: traefik-net
  </code></pre>
  
  <p><strong>docker-compose-whoami.yml</strong></p>
  
  <pre><code>version: "3.7"
  
  services:
    whoami:
      image: "jwilder/whoami"
      networks:
        - traefik-net
      deploy:
        replicas: 3
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.whoami.rule=Host(`mydomain.com`)"
          - "traefik.http.routers.whoami.entrypoints=web"
          - "traefik.http.services.whoami.loadbalancer.server.port=8000"
  
  networks:
    traefik-net:
      external:
        name: traefik-net
  </code></pre>
  
  <p><code>jwilder/whoami</code> exposes port 8000 in its <a href="https://hub.docker.com/r/jwilder/whoami/dockerfile" rel="nofollow noreferrer">Dockerfile</a>. I want to redirect port 5000 (my entrypoint defined in docker-compose-traefik.yml) to port 8000 in container.</p>
  
  <p>I created network <code>traefik-net</code> with: <code>docker network create -d bridge traefik-net</code>.</p>
  
  <p>I deployed both stacks with:</p>
  
  <ol>
  <li><code>docker-stack deploy -c docker-compose-traefik.yml Traefik</code></li>
  <li><code>docker-stack deploy -c docker-compose-whoami.yml Whoami</code></li>
  </ol>
  
  <p>When I visit mydomain.com:9000 it opens Traefik dashboard as it should. When I visit mydomain.com:5000 it says that "This site can’t be reached".</p>
  
  <p>My question is: <strong>How to redirect request to port 5000 (mydomain.com:5000) to port 8000 inside whoami container?</strong></p>