Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Docker Engine start containers in parallel

Tags:

docker

If I have scripts issueing docker run commands in parallel, the docker engine appears to handle these commands in series. Since runing a minimal container image with "docker run" takes around 100ms to start does this mean issueing commands in parallel to run 1000 containers will take the docker engine 100ms x 1000 = 100 s or nearly 2 minutes? Is there some reason why the docker engine is serial instead of parallel? How do people get around this?

like image 244
Michael Avatar asked Jul 17 '15 03:07

Michael


People also ask

Can Docker run parallel?

Docker is just a way of deploying your application - it does not in itself allow you to 'support' parallelism just by using Docker. Your application itself needs to support parallelism.

Can you run 2 Docker containers at the same time?

With Docker compose, you can configure and start multiple containers with a single yaml file. This is really helpful if you are working on a technology stack with multiple technologies.

Can 2 Docker containers talk to each other?

If you are running more than one container, you can let your containers communicate with each other by attaching them to the same network. Docker creates virtual networks which let your containers talk to each other. In a network, a container has an IP address, and optionally a hostname.

Can two containers run same image?

A Docker image executes code in a Docker container. You add a writable layer of core functionalities on a Docker image to create a running container. Think of a Docker container as a running image instance. You can create many containers from the same image, each with its own unique data and state.


1 Answers

How do people get around this?

a/ They don't start 1000 containers at the same time b/ if they do, they might use a cluster management system like docker swarm to manage the all process c/ they do run 1000 containers, in advance in order to take into account the starting time.

Truly parallelize docker run command could be tricky considering some of those command might depend on other containers to be created/started first (like a docker run --volumes-from=xxx)

like image 162
VonC Avatar answered Sep 29 '22 08:09

VonC