How to create and run n containers form an image

Hi,
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.

Thanks,
Vishwanath

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: http://docs.docker.com/compose/

1 Like

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

Try to look at : http://www.cloudslang.io/
It has parallel capability to launch containers…

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

Thanks,
Vishwanath

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

Thanks,
Vish

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

Thanks,
Vishwanath