[swarm mode] Random published port not accessible upfront using . It needs an update #47835
Labels
area/networking/portmapping
area/networking
area/swarm
kind/bug
Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
status/0-triage
version/26.1
Description
I'm trying to deploy a web service using random published port and ingress mode on a docker desktop node. (Haven't tried on multiple agents).
The service is not accessible using accessible upfront, I have to update the ports manually through a second command.
The issue is not there when using compose instead of
stack deploy
.Reproduce
docker swarm init
(if necessary)docker-compose.yml
file as followdocker stack deploy -c .\docker-compose.yml -d my_stack
docker service ls
: grab the published portcurl http://localhost:{exposed_port}
: failure to connect to the serverTo "fix" the issue:
docker service update --publish-rm published={published_port},target=8000 --publish-add published={published_port},target=8000 my_stack_webapp
The
--publish-rm
is not necessary but otherwise there will be 2 published ports, one of them leading to an unsuccessful query.Expected behavior
you should see a whale and a hello-world text
docker version
Client: Cloud integration: v1.0.35+desktop.13 Version: 26.1.1 API version: 1.45 Go version: go1.21.9 Git commit: 4cf5afa Built: Tue Apr 30 11:48:43 2024 OS/Arch: windows/amd64 Context: default Server: Docker Desktop 4.30.0 (149282) Engine: Version: 26.1.1 API version: 1.45 (minimum version 1.24) Go version: go1.21.9 Git commit: ac2de55 Built: Tue Apr 30 11:48:28 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.31 GitCommit: e377cd56a71523140ca6ae87e30244719194a521 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
system: windows 10
windows defender off
The text was updated successfully, but these errors were encountered: