'Maximum number of deployable docker containers

I'm trying to deploy a large number of containers.

  1. I don't want to use swarm nor kubernetes scaling them, because each one has a different configuration, environment variables, entry port, etc.
  2. I already know that the maximum number of container per docker network bridge is 1023.
  3. My host doesn't have memory or CPU usage problems with 1023 containers. Approximately it looks it could work with more than 3000 containers.

Once we start from this, I try to increase the number of deployed docker in the same host creating several docker network bridge with Networking with docker howto

docker network create --driver bridge mydocker-net0 
docker network create --driver bridge mydocker-net1
...

Harnessing docker uses Class B IP for containers, possible private IP belong to the interval: 172.16.0.0 - 172.31.255.255. So, theoretically, it could assign 2^19 possible docker network bridges, but I'm not sure that so many are possible.

Finally, I'm looking forward [MAX_NUMBER_CONTAINERS] = [MAX_NUMBER_DOCKER_BRIDGES] * 1023

Anyone has tested which is [MAX_NUMBER_DOCKER_BRIDGES] or knows about other way to deploy a large number of containers in the same host without scaling with kubernetes nor swarm or similar, please?



Solution 1:[1]

I have been able to run 6055 docker containers using 10 bridges. See details on https://unix.stackexchange.com/a/688385/2972

More than 6055 makes the server unstable: https://serverfault.com/questions/1091520/docker-blocks-when-running-multiple-containers

Solution 2:[2]

have you considered the easiest option of all? Just simple bash script. This will start 10 containers, and you can put some configs inside the run option with some bash tricks...

#!/bin/sh
for (( i = 0; i < 10; i++ )); do
    docker run -d --name my_$i alpine sh
done

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ole Tange
Solution 2 Mazel Tov