I am having some trouble connecting to a service using Docker swarm’s randomized port. So far I have only had this problem when using Docker Desktop, I cannot reproduce this when connecting to an external node.
For example:
docker service create --publish target=9000 minio/minio server /data
If I create this service on my laptop, Docker will assign it a randomized port (lets say 30006), but I will not be able to connect to it from a web browser. Service and container information look normal.
However, if i manually assign the same port:
docker service create -p 30006:9000 minio/minio server /data
This creates a service that I can connect to from a web browser (localhost:30006).
Has anyone else experienced this issue?
Windows 10 version 2004 (OS Build 19041.388)
Docker Desktop (community) 2.3.0.4 (46911) Stable
Docker Engine: 19.03.12
mode=host is not working for Docker Desktop for Windows.
You got the published port by checking docker service inspect, didn’t you?
Kind of odd that the docs do not show an example where only target is specified. This looks like either a doku bug (missing example without publish=*) or it’s a bug in the cli