How to list containers in Docker

DevOps

There's a command to list images, docker images, but there doesn't seem to be a corresponding docker container.

Other than becoming root and looking into /var/lib/docker there doesn't seem a way to do that. Am I missing something? Is that something one isn't supposed to do?

2
Answers

Replies

The latest version of Docker has updated its commands. The command to list the containers is,



docker container ls 



The command to list the running containers.



docker container ls -a

 

Docker has a rich set of commands that you can use for various operations.



To know the list of all the running Docker containers, 



docker ps



To know the list of all the Docker containers including running and stopped, 



docker ps –a



If you want to list the containers with just their ID's, 



docker ps –aq



To list the containers along with their size,



docker ps –s



To know the list of latest created containers, 



docker ps –l

 
 

If you want to unleash your potential in this competitive field, please visit the DevOps course page for more information, where you can find the DevOps tutorials and DevOps frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.