Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in DevOps and Agile by (2.3k points)
edited by

how to start all containers in docker?

2 Answers

0 votes
by (6.9k points)

The question is a little ambiguous:

If you mean to create multiple containers at the same time then you will have to make use of docker-compose.

OR

If you are just looking to start up all the stopped container use this command:

$ sudo docker start $(docker ps -a -q)

This will startup any stopped containers.

Hope this Helps :)


getting stuck working with docker? need supervision while learning about it? try out docker training course.

0 votes
ago by (1.3k points)

To start all running Docker containers, you do:

docker start $(docker ps -aq)

Here is how it goes:

docker ps -aq prints out all container ids, both running and stopped.

Wrapping this command with docker start starts them all at once.


But you can use Docker Compose and run:

docker-compose up

It brings up all services defined in docker-compose.yml. Add a -d flag to let them run in detached mode.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...