Docker Community Forums

Share and learn in the Docker community.

How to create and run n containers form an image

(Vishwamanchala) #1

I would like to start n containers from an image. For example, when run command issued in docker CLI, daemon pulls an image, creates a single container from the image and runs the container. Similarly I want to create n number of containers from same image and start the containers.
Please assist me how to proceed.


(Jerry Baker) #2

Hi vishwamanchala,

For simple configurations you can use a bash for loop:

for i in {1..5}; do docker run -d nginx; done

but if you need more control over your stack I’d use Docker Compose for launching. See:

(Crosen188) #3

You could also deploy a scalable group of containers on IBM Bluemix (, which gives you the ability to upload any Docker image and control the quantity of instances.

(Meir Wahnon) #4

Try to look at :
It has parallel capability to launch containers…

(Vishwamanchala) #5

Thanks Jerry.
I have tried the script but it is launching only one container.


(Vishwamanchala) #6

Now I am able to run. This is a bash issue.


(Vishwamanchala) #7

Could anyone plz answer for my post Container not getting started after start command issued