Docker Community Forums

Share and learn in the Docker community.

Docker Swarm(Networking Port) doesn't work on Debian 10

With a fresh installed Ubuntu 20.4, and with commands

docker swarm init
docker service create --name nginx --replicas 1 --publish published=8080,target=80 nginx
curl localhost:8080

curl could get a response from nginx

Replacing the OS with Debian 10 with the same commands, curl just hangs there and waiting for a response.
It only works when I change networking to mode=host

docker swarm init
docker service create --name nginx --replicas 1 --publish published=8080,target=80,most=host nginx
curl localhost:8080

The behaviour can be reproduced using the Debian and Ubuntu images on Google Cloud Compute.

Is this an expected behaviour?