Docker stack on Ubuntu : ports mapping

Hi :slight_smile:

I’ve installed Docker v17.03.0-ce on Ubuntu 16.04.
I have to start a stack on this server… When i do that, ports are not mapped.

debian.yml :

version: '3'
       image: debian
        - "2222:2222"
       command: /bin/bash -c "ping localhost"

$ docker stack deploy -c debian.yml test
$ netstat -paunt |grep 2222

If I start container with docker run, then ports are mapped.

$ docker run -itd -p “2222:2222” debian bash
$ netstat -paunt |grep 2222
tcp6 0 0 :::2222 :::* LISTEN 5569/docker-proxy

I’ve also tested docker stack on debian : port mapping works on Debian…

Does someone know why port mapping doesn’t seem to work on Ubuntu with docker stack?

Thank you :slight_smile:

Hi, facing the same issue. Ubuntu 16.04, Docker version 17.05.0-ce, build 89658be. Was you able to solve this problem?

No, i didn’t solve this issue. I don’t need docker swarm for the moment, so I use docker-compose instead of docker stack.

Same issue here, 16.04 and Docker version 17.05.0-ce, build 89658be

Docker stack not use host port mappings by default. It use overlay ingress mapping. Try docker-compose.yml network_mode: "host" to get mapping behavior like simple docker run.