Docker service: Expose ports problem Version: 17.03.0-ce

Issue type: Ports are inaccessible
Exposed ports are inaccesible for Docker service, this used to work with docker 1.13.1 and below but now ( Version: 17.03.0-ce) I can’t reach my application UI on port 8080

I started the service using:

docker service create --name spark-master \
--constraint 'node.hostname==master' \
-p 8080:8080 -p 7077:7077 -p 6066:6066 \
vetional/spark:latest /start-master.sh 

The service gets created with the following properties (using docker inspect spark-master)

[
    {
        "Id": "5bd395928c09c602e1067bc754493f14581ccaa85be97884eac11c63511011a5",
        "Created": "2017-03-08T10:46:00.476986212Z",
        "Path": "/start-master.sh",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 20339,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2017-03-08T10:46:01.195335723Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:51167b123644c8d524f273736c557b838d90f481551e5d6da9e9dfa573485624",
        "ResolvConfPath": "/var/lib/docker/containers/5bd395928c09c602e1067bc754493f14581ccaa85be97884eac11c63511011a5/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/5bd395928c09c602e1067bc754493f14581ccaa85be97884eac11c63511011a5/hostname",
        "HostsPath": "/var/lib/docker/containers/5bd395928c09c602e1067bc754493f14581ccaa85be97884eac11c63511011a5/hosts",
        "LogPath": "/var/lib/docker/containers/5bd395928c09c602e1067bc754493f14581ccaa85be97884eac11c63511011a5/5bd395928c09c602e1067bc754493f14581ccaa85be97884eac11c63511011a5-json.log",
        "Name": "/spark-master.1.n86cndr3gomxdy159xbxiqcsg",
        "RestartCount": 0,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "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,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": null,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Name": "aufs",
            "Data": null
        },
        "Mounts": [],
        "Config": {
            "Hostname": "5bd395928c09",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/jdk1.8.0_112/bin:/usr/hadoop-2.7.3/bin:/usr/spark-2.1.0/bin",
                "LANG=en_US.UTF-8",
                "LANGUAGE=en_US:en",
                "LC_ALL=en_US.UTF-8",
                "PYTHONHASHSEED=0",
                "PYTHONIOENCODING=UTF-8",
                "PIP_DISABLE_PIP_VERSION_CHECK=1",
                "JAVA_HOME=/usr/jdk1.8.0_112",
                "HADOOP_VERSION=2.7.3",
                "HADOOP_HOME=/usr/hadoop-2.7.3",
                "HADOOP_CONF_DIR=/usr/hadoop-2.7.3/etc/hadoop",
                "SPARK_VERSION=2.1.0",
                "SPARK_PACKAGE=spark-2.1.0-bin-without-hadoop",
                "SPARK_HOME=/usr/spark-2.1.0",
                "SPARK_DIST_CLASSPATH=/usr/hadoop-2.7.3/etc/hadoop/*:/usr/hadoop-2.7.3/share/hadoop/common/lib/*:/usr/hadoop-2.7.3/share/hadoop/common/*:/usr/hadoop-2.7.3/share/hadoop/hdfs/*:/usr/hadoop-2.7.3/share/hadoop/hdfs/lib/*:/usr/hadoop-2.7.3/share/hadoop/hdfs/*:/usr/hadoop-2.7.3/share/hadoop/yarn/lib/*:/usr/hadoop-2.7.3/share/hadoop/yarn/*:/usr/hadoop-2.7.3/share/hadoop/mapreduce/lib/*:/usr/hadoop-2.7.3/share/hadoop/mapreduce/*:/usr/hadoop-2.7.3/share/hadoop/tools/lib/*"
            ],
            "Cmd": [
                "/start-master.sh"
            ],
            "Image": "vetional/spark@sha256:a9e9ac95d4efd278879387391d67d1f591e5298d13796873621f9e8170ce8c8c",
            "Volumes": null,
            "WorkingDir": "/usr/spark-2.1.0",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "com.docker.swarm.node.id": "g4z5m2cs3q53jn5k3n96g0ush",
                "com.docker.swarm.service.id": "tl3k19a2pd3j9rv52j3vpfh9q",
                "com.docker.swarm.service.name": "spark-master",
                "com.docker.swarm.task": "",
                "com.docker.swarm.task.id": "n86cndr3gomxdy159xbxiqcsg",
                "com.docker.swarm.task.name": "spark-master.1.n86cndr3gomxdy159xbxiqcsg"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "60df8a18927979fa21af05933b39443019826cc8ab099101c8b13be6e8a23da2",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/60df8a189279",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "ingress": {
                    "IPAMConfig": {
                        "IPv4Address": "10.255.0.5"
                    },
                    "Links": null,
                    "Aliases": [
                        "5bd395928c09"
                    ],
                    "NetworkID": "32k4pzk5as5xge2d7w25zrkbn",
                    "EndpointID": "66c312f13db1224e44817d84a0e4d72a2e36d2dccf013ae0692e634a0f3480c5",
                    "Gateway": "",
                    "IPAddress": "10.255.0.5",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:0a:ff:00:05"
                }
            }
        }
    }
]

Describe the results you received:
Exposed ports are inaccesible, eg. if I visit :8080 on my machine it results in an error.

Describe the results you expected:

Published ports are expected to be accessible.

Output of docker version:

Client:
 Version:      17.03.0-ce
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   60ccb22
 Built:        Thu Feb 23 10:53:29 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.0-ce
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   60ccb22
 Built:        Thu Feb 23 10:53:29 2017
 OS/Arch:      linux/amd64
 Experimental: false
2 Likes

I am also facing the same issue. I cant access the published ports from any of the warm node , not even manager

1 Like

Any updates on this? @vetional were you able to sort it out?