Swarm binding to localhost

in docker 9.13 we can start docker service with localhost binding to 127.0.0.1 on all nodes

docker service create --name tor --network mynetwork --constraint ‘node.Labels.type == worker’ --replicas 3 -p 127.0.0.1:9050:9050 -p 127.0.0.1:8118:8118 -p 127.0.0.1:9051:9051 -e “PASSWORD=123123” andreas4all/tor-client:latest

but on working node it bind like -p 9050:9050 and accessible via internet not only localhost

then service up i see via nmap

Host is up (0.054s latency).
Not shown: 994 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
25/tcp filtered smtp
80/tcp open http
443/tcp open https
9050/tcp open tor-socks

after service scale tor=0 , we see port 9050 disappear

Host is up (0.063s latency).
Not shown: 995 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
25/tcp filtered smtp
80/tcp open http
443/tcp open https

1 Like