Large startup time for docker containers due to network?

Hi

When multiple containers are launched simultaneously, the startup time for containers increases with the number of containers being launched. For example, if I try to launch 70 containers, it takes ~20 seconds for all containers to be running. After some performance debugging using pprof and perf, it was observed that docker spends majority its time connecting each container to the network (possibly spinning on iptable lock). If I disable the network (–network=none), the startup time for 70 containers is ~8 seconds.

Is this an expected behavior? Does docker not scale well due to network bottleneck? Is there a workaround?

OS Version: Ubuntu 16.04.1 LTS
Docker version: Docker version 17.07.0-dev, build

Steps to reproduce:

  1. Save the current time
  2. Start 70 containers simultaneously (container need not do any operation)
  3. Measure the startup time for each container using the docker inspect command and the saved time
  4. Repeat the steps by setting the network to “none” (–network=none)

Thanks
Anup

1 Like

I am observing the same issue. With multiple containers the start up time grows exponentially when started with a network. Anyone have a solution or possible reason?

Hi, did you find any proper solution, facing same issue.

1 Like

Thanks it is valuable and it is very nice that you have posted the solution. Much Appreciated and keep up the good work.

1 Like

Hey, did you get any proper solution regarding this? If yes, please share the solution with us!

Thanks alot it really worked

This also happens with me, I mean when I try to open 20-30 dockers it takes approx 15 seconds.

Thanks for the solution mate. It works.

  • Save the current time .
  • Start 70 containers simultaneously ( container need not do any operation)
  • Measure the startup time for each container using the docker inspect command and the saved time .
  • Repeat the steps by setting the network to “none” (– network =none)Official Site