Docker Community Forums

Share and learn in the Docker community.

Really slow container startup with long port ranges


(Juan Luis Baptiste) #1


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.

(Akprats) #2

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.

(Juan Luis Baptiste) #3

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

(Derekamz) #4

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

docker version: 17.09.0-ce