title: Docker Swarm + Traefik: Expose Traefik GUI through frontend rule; Service / Container port redirection
body: <p>I am trying to use Traefik with Docker Swarm backend, and I am using the stack file below:</p>
  
  <pre><code>version: "3"
  
  services:
  
    traefik:
      image: traefik:1.5
      command: --web --docker --docker.swarmmode --docker.watch --docker.domain=sample.com --logLevel=DEBUG 
      deploy:
        placement:
          constraints: [node.role==manager]
        restart_policy:
          condition: on-failure
        labels:
          - "traefik.port=8080"
          - "traefik.docker.network=sample-network"
          - "traefik.frontend.rule=Host:traefik.sample.com"
      ports:
        - "80:80"
        - "8080:8080"
        - "443:443"
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - /dev/null:/traefik.toml
      networks:
        - sample-network
  
    portainer:
      image: portainer/portainer:latest
      command: --no-auth -H unix:///var/run/docker.sock
      deploy:
        placement:
          constraints: [node.role == manager]
        labels:
          - "traefik.portainer.port=7777"
          - "traefik.docker.network=sample-network"
          - "traefik.frontend.rule=Host:portainer.sample.com"
      ports:
        - "7777:9000"
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      networks:
        - sample-network
  
  networks:
    sample-network:
  </code></pre>
  
  <p>I have 2 questions that I am trying to wrap my head around:</p>
  
  <p>1) (Exposing Traefik dashboard through frontend rule) I can access Traefik's web dashboard on <code>sample.com:8080</code>, yet I cannot access it through <code>traefik.sample.com</code>.</p>
  
  <p>2) (Port Redirection on containers/services) I can access Portainer GUI through <code>sample.com:7777</code>, yet I cannot access it through <code>portainer.sample.com</code>. I am more curious of port redirection, because how will I setup 2 services in a single stack file if I encounter 2 images publishing to the same port? My service label declarations will clash at <code>traefik.port=XXXX</code></p>