moby: Ports not getting published for stack/service
Description when running a ‘docker stack deploy’ for a stack, the ‘ports:’ node in the yaml/stack/compose file seems to get ignored. Also, when running ‘docker service update --publish-add’ nothing changes for the stack’s service.
Steps to reproduce the issue:
- run a ‘docker stack deploy -c [composefile].yml --with-registry-auth [stackname]’ command with a stack/compose file that has a ‘ports:’ config node for the service (the port i’m trying to publish is 10125:80 or 10125:10125, either will work for my needs) NOTE - Host has 2 physical network ports, and is swarm-joined as manager.
Describe the results you received: docker container inspect [container] shows no ports published under “NetworkSettings”: {“Ports”:} nor “HostConfig”:{ “PortBindings”:}, however, ‘docker container list’ shows only ‘80/tcp’ under the “PORTS” column. ‘netstat -ano’ shows no ports listening on the ports listed in the stack/compose file
Describe the results you expected: Any ports listed with proper syntax under the “ports:” node in the stack/compose file should be published and available upon deploy.
Additional information you deem important (e.g. issue happens only occasionally): Running on Windows Server 2016 Core, I stopped the docker service and replaced the 17.03-ee version of the docker.exe and dockerd.exe binaries with the version I’m currently running (see below).
Output of docker version
:
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.24)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 22:19:00 2017
OS/Arch: windows/amd64
Experimental: false
Output of docker info
:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 6
Server Version: 17.06.0-ce
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd json-file logentries splunk syslog
Swarm: active
NodeID: lpiiypps4syxypp0he5xfex5d
Is Manager: true
ClusterID: e1t83w9bh5ipu0ellmg4gxkwf
Managers: 4
Nodes: 5
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 3
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Root Rotation In Progress: false
Node Address: 10.0.3.233
Manager Addresses:
10.0.3.169:2377
10.0.3.224:2377
10.0.3.233:2377
10.0.3.249:2377
Default Isolation: process
Kernel Version: 10.0 14393 (14393.1358.amd64fre.rs1_release.170602-2252)
Operating System: Windows Server 2016 Standard
OSType: windows
Architecture: x86_64
CPUs: 2
Total Memory: 2GiB
Name: GPSDWZ-IA
ID: MF3L:JAY7:AOEM:WK7Y:BNPS:4JBG:JETJ:YWTU:AGH3:WR4S:RHCA:JDWU
Docker Root Dir: E:\Docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
resgistry1:5000
127.0.0.0/8
Live Restore Enabled: false
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 25 (8 by maintainers)
Note that when using
mode: host
, the routing mesh is not used, and containers are published directly, as a result, only a single instance of the service can run on each node, and the service will only be accessible on nodes where an instance is running.However, the problem looks to be you’re not using the right configuration to publish your ports. In the first example;
You are publishing:
80
on port80
on the host10125
on port10125
on the hostSo (unless the container is actually listening on port 10125), that won’t work, because
nginx
would be listening on port80
.In the second example (long syntax), it looks like you swapped the ports;
Here you publish container’s port
10#{inst}
(10125
) to port80
on the hostTry using this;
And it should probably work