Really slow container startup with long port ranges

Hi,

I have noticed that when I map a big port range to the host, the container startup can take several minutes (or even hang). The bigger the range, the longer the delay. And the docker client seems unresponsive to commands such as docker ps while the container finish starting. The only way out is to wait until container has finished starting, or restart the docker engine.

sudo docker run --name my_container --rm -p 16384-16600:16384-16600 my_image

After 20 minutes it hasn’t finished starting, could not remove it (docker client unresponsive) and had to restart the docker daemon. Changing the range to a smaller one, like 16384-16600 takes around two minutes and an smaller one like 16384-16400 will take a couple of seconds. What’s going on ?

I’m using docker 1.12 on ubuntu 16.10.

1 Like

Hi @juanluisbaptiste. Did you find any workaround for this ? I am stuck in the same situation where I need to expose thousands of ports. One workaround could be to add port forwarding rules in the iptables using a shell script.

Nope I didn’t, but I haven’t tested again with recent docker versions.

I have same issue. Is there any update for this issue?

docker version: 17.09.0-ce