Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

0 votes
by (2.3k points)

So we know that docker gives us the ability to list all the different containers that currently running using the below commmand :

$ docker ps # To list running containers

Then we can use the below command to list all the containers regardless of the fact whether they are running or not. 

$ docker ps -a # To list running and stopped containers

Is there a way where we only list those containers that are stopped and not the ones that are running?

1 Answer

0 votes
by (6.9k points)

To find out only the containers that are stopped you can use the below command :

$ docker ps --filter "status=exited"

Or use this command :

$ docker ps -f "status=exited"

Hope that helped :)

If you want to improve your docker skills and get that job you always yearned for try out docker training course. 

Browse Categories