traefik: Multiple ports per service not working

What version of Traefik are you using (traefik version)?

commit 677899d9ff7790c4c2abeb35f7ecba7fa266c74c cointainer containous/traefik:experimental

What is your environment & configuration (arguments, toml…)?

    docker service create \
        --name traefik \
        --constraint=node.role==manager \
        --publish 80:80 --publish 8080:8080 \
        --mount "type=bind,source={{ remote_config }}/traefik.toml,target=/etc/traefik/traefik.toml" \
        --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
        --network proxy \
        --mode global \
        containous/traefik:experimental \
        --docker \
        --docker.swarmmode \
        --docker.domain=traefik \
        --docker.watch \
        --web

What did you do?

I created simple service as

    docker service create \
    --name=visualizer \
    --network=proxy \
    --constraint=node.role==manager \
    --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
    --label traefik.visualizer.port=8080 \
    --label traefik.visualizer.network=proxy \
    --label traefik.visualizer.frontend.rule=Host:visualizer.traefik \
    --label traefik.visualizer.frontend.entryPoints=http,https \
    manomarks/visualizer:latest

What did you expect to see?

In traefik gui, service visualizer.

What did you see instead?

Nothing


While putting old school label --label traefik.port=8080 is working this .visualizer. as <service-name> is not (--label traefik.visualizer.port=8080).

<service-name> was introduced in https://github.com/containous/traefik/pull/1257

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 23 (10 by maintainers)

Most upvoted comments

I’m using traefik with swarm and I confirm that defining multiple ports does not work for me either.

Hi

Same here

Version:      v1.3.0-rc1
Codename:     raclette
Go version:   go1.8.1
Built:        2017-05-05_02:03:01PM
OS/Arch:      linux/amd64

When I place labels on service like that, it’s OK :

        - 'traefik.frontend.rule=Host:s1.mydomain.org'
        - "traefik.port=80"

But like that I got Filtering container without port and no traefik.port label

        - 'traefik.s1.frontend.rule=Host:s1.mydomain.org'
        - "traefik.s1.port=80"
        - 'traefik.s2.frontend.rule=Host:s2.mydomain.org'
        - "traefik.s2.port=8081"

I experienced a similar problem when trying to use Nexus3 in swarm mode to host multiple Docker repos using a frontend rule per exposed port. In the end up what worked for me was adding the following rules to my nexus3 service. It wouldn’t work unless I included a traefik.frontend.rule + port.

v1.3.4 / raclette

traefik.docker.network=nexus3_nexus traefik.dockergroup.frontend.rule=Host:docker.nexus.local.com traefik.dockergroup.port=9100 traefik.enable=true traefik.frontend.rule=Host:ui.nexus.local.com traefik.nexus.frontend.rule= Host:ui.nexus.local.com traefik.nexus.port=8081 traefik.port=8081 traefik.internalrepo.frontend.rule=Host:internalrepo.nexus.local.com traefik.internalrepo.port=9101

@BSchwetzel Yes, indeed that looks to be an issue. Seems like containerFilter only honors traefik.port tag and does not look at the service tags (https://github.com/containous/traefik/blob/master/provider/docker/docker.go#L503)

But the question still remains - if the container does not expose any ports (according to the docker inspect), how will the routing actually happen from the networking standpoint? Is the Traefik instance running internally on the docker custom network, so the network calls happen on the inside cross-container, without outside access?