-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple ports per service not working #1321
Comments
@benoitf do you possibly have any idea? |
AFAIK there is no
|
You are right! but its still not working
|
OK i will check but it is looking like if support is not inside the traefik docker image you're using |
still no luck
|
@dcrystalj could you enable logLevel with DEBUG ? |
traefik.1.j36czrlk8cea@swarm-02 | time="2017-04-18T12:42:05Z" level=debug msg="Filtering container without port and no traefik.port label visualizer.1"
traefik.1.j36czrlk8cea@swarm-02 | time="2017-04-18T12:42:05Z" level=debug msg="Filtering container without port and no traefik.port label traefik.1"
traefik.1.j36czrlk8cea@swarm-02 | time="2017-04-18T12:42:05Z" level=debug msg="Configuration received from provider docker: {}"
traefik.1.j36czrlk8cea@swarm-02 | time="2017-04-18T12:42:05Z" level=info msg="Skipping same configuration for provider docker" This logs are repeating. |
Hi Same here
When I place labels on service like that, it's OK :
But like that I got
|
Same problem here. Compose file: version: '3.1'
services:
master:
deploy:
replicas: 1
placement:
constraints:
- node.role==manager
command: "--docker --docker.swarmmode --docker.domain=traefik --docker.watch --web --loglevel=DEBUG"
image: "traefik:v1.3"
ports:
- "80:80"
- "443:443"
- "8081:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- mynet
networks:
mynet:
external: true (Proxied) Service Inspect: "Labels": {
"traefik.config.frontend.rule": "PathPrefixStrip:/geocoding-osm-config",
"traefik.config.port": "8081",
"traefik.docker.network": "mynet",
"traefik.web.frontend.rule": "PathPrefixStrip:/geocoding-osm",
"traefik.web.port": "8080"
} Log output: time="2017-05-16T09:56:46Z" level=debug msg="Filtering container without port and no traefik.port label geocoding-osm.1"
time="2017-05-16T09:56:46Z" level=debug msg="Filtering container without port and no traefik.port label geocoding-osm.2" |
Could you provide the output of |
Sure: docker inspect[
{
"Id": "8197d1e0d076341deaa5432777f35636829723edb2c4ff18597ad2c7ccf8df08",
"Created": "2017-05-16T09:36:06.482902265Z",
"Path": "/bin/sh",
"Args": [
"-c",
"exec java -jar -Djava.security.egd=file:/dev/urandom -Dspring.profiles.active=$SPRING_ACTIVE_PROFILE geocoding-osm-1.0.0.jar"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 27817,
"ExitCode": 0,
"Error": "",
"StartedAt": "2017-05-16T09:36:07.469431068Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:9a353e4e27107fb63764c92c9b28204a6051ce8a7bb0850d17096e236ecbd193",
"ResolvConfPath": "/var/lib/docker/containers/8197d1e0d076341deaa5432777f35636829723edb2c4ff18597ad2c7ccf8df08/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/8197d1e0d076341deaa5432777f35636829723edb2c4ff18597ad2c7ccf8df08/hostname",
"HostsPath": "/var/lib/docker/containers/8197d1e0d076341deaa5432777f35636829723edb2c4ff18597ad2c7ccf8df08/hosts",
"LogPath": "",
"Name": "/geocoding-osm.2.vsjfbzpy2tlseti853vxpzpt7",
"RestartCount": 0,
"Driver": "aufs",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "gelf",
"Config": {
"env": "SPRING_ACTIVE_PROFILE",
"gelf-address": "udp://127.0.0.1:12201",
"labels": "com.docker.swarm.service.name"
}
},
"NetworkMode": "default",
"PortBindings": {},
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"DeviceCgroupRules": null,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": -1,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0
},
"GraphDriver": {
"Data": null,
"Name": "aufs"
},
"Mounts": [],
"Config": {
"Hostname": "8197d1e0d076",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"SPRING_ACTIVE_PROFILE=development",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DEBIAN_FRONTEND=noninteractive",
"LANG=C.UTF-8",
"JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre",
],
"Cmd": null,
"ArgsEscaped": true,
"Image": "registry.local/myns/geocoding-osm:1.0.0@sha256:5f05790ff2476b65065687c12c70e9dcd5e72ae3e3d021589b54e6c9d4e03e32",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/bin/sh",
"-c",
"exec java -jar -Djava.security.egd=file:/dev/urandom -Dspring.profiles.active=$SPRING_ACTIVE_PROFILE geocoding-osm-1.0.0.jar"
],
"OnBuild": null,
"Labels": {
"com.docker.swarm.node.id": "xtky7938ptpf0k41peyd2opa8",
"com.docker.swarm.service.id": "a1onhl095h78bxx2j0g79noq0",
"com.docker.swarm.service.name": "geocoding-osm",
"com.docker.swarm.task": "",
"com.docker.swarm.task.id": "vsjfbzpy2tlseti853vxpzpt7",
"com.docker.swarm.task.name": "geocoding-osm.2.vsjfbzpy2tlseti853vxpzpt7",
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "67bafaf0afc4382eac53d62bee71b40a10bc63a807cf2d31055c392f4c1f8c59",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/67bafaf0afc4",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"egov": {
"IPAMConfig": {
"IPv4Address": "10.0.0.33"
},
"Links": null,
"Aliases": [
"8197d1e0d076"
],
"NetworkID": "elna4snc2j34e68sx3axjli2y",
"EndpointID": "c6bfe20b634ae07f2b9178cff011e3cd1153b311f4822fdf18d2e5900cfd90e0",
"Gateway": "",
"IPAddress": "10.0.0.33",
"IPPrefixLen": 24,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:0a:00:00:21"
},
"ingress": {
"IPAMConfig": {
"IPv4Address": "10.255.0.41"
},
"Links": null,
"Aliases": [
"8197d1e0d076"
],
"NetworkID": "x1itm34yur65bgllyopbfaplh",
"EndpointID": "887529c8cc0aa5fa58de78408a7a87b8b84336bbd0157be43f80f63906209986",
"Gateway": "",
"IPAddress": "10.255.0.41",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:0a:ff:00:29"
}
}
}
}
] |
I'm not entirely sure of a reason as to why, but based on the Do you specify the port mappings when you launch the containers? |
Well, I am providing explicit labels, as shown in the Service Inspect part:
When using traefik.port at exactly the same place it will work (meaning that service labels should be sufficient), but then I am limited to that one port. I thought the "traefik-services" (config and web in this case) were created to remove this limitation? To me it seems that traefik doesn't look for labels matching "traefik.SOMETHING.port" and "traefik.SOMETHING.frontend.rule" when creating its config. |
@BSchwetzel Yes, indeed that looks to be an issue. Seems like But the question still remains - if the container does not expose any ports (according to the |
In my case the traefik instance is running inside the swarm and on the same overlay network. Adding EXPOSE to the Dockerfile of the service leads to "ExposedPorts": {
"8080/tcp": {},
"8081/tcp": {}
}, and "Ports": {
"8080/tcp": null,
"8081/tcp": null
}, being added to the output of docker inspect, but the traefik log still shows the same problem. So is there something else wrong? As it is a Swarm service, I cannot publish the ports per container. |
@ldez, or other maintainers, can probably correct me if I'm wrong, but looks like in this scenario there is no external port being exposed, so currently Traefik is not considering the use-case where no exposed ports have been defined and no |
Not sure but this appears to be fixed in the newest version. I was testing and failing constantly but after a docker pull and restart this compose file suddenly started working. |
Weird, with 1.3.3 I'm still getting these log messages. Are you deploying those as standalone containers or to a swarm (using docker stack deploy)? I see you are using "restart: always" in your compose file, so I believe you're not using swarm. I'd assume that it can read your exposed ports then, whereas my deployment, using a swarm service, does not set those ports in the same way and therefore cannot be read correctly by traefik. |
I'm using traefik with swarm and I confirm that defining multiple ports does not work for me either. |
I think what needs to happen is to change the port check at the very beginning of _, err := strconv.Atoi(container.Labels[types.LabelPort])
if len(container.NetworkSettings.Ports) == 0 && err != nil {
if p.hasServices(container) {
foundServicePort := false
for _, serviceName := range p.getServiceNames(container) {
if len(p.getServicePort(container, serviceName)) > 0 {
foundServicePort = true
}
}
if !foundServicePort {
log.Debugf("Filtering container wihtout port and no traefik.port or traefik.<service>.port label %s", container.Name)
return false
}
} else {
log.Debugf("Filtering container without port and no traefik.port label %s", container.Name)
return false
}
} basically adding an extra check to see if service labels are present, in which case to check each service for presence of service port label, otherwise filtering it out. Thoughts? |
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
|
This also worked for me. |
Closed by #2330. |
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
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 #1257The text was updated successfully, but these errors were encountered: