How do I list containers in Docker?

0 votes

I know the command to list images in docker but it doesn't seem to be a corresponding docker containers.

Other than becoming root and looking into /var/lib/docker there doesn't seem a way to do that. Is there any other way around?

Can anyone help me with this query?

Thanks.

Sep 4, 2018 in DevOps & Agile by shubham
• 6,560 points
47 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

To view running containers use  below command:

docker ps

I you want to view all containers use the given command:

docker ps -a

If want to view latest created container (includes all states) use the given command:

docker ps -l

To show n last created containers (includes all states) use the given command:

docker ps -n=-1

To display total file sizes use the given command:

docker ps -s

The content presented above is from docker.com.

In the new version of Docker, commands are updated, and some management commands are added:

docker container ls

Is used to list all the running containers.

docker container ls -a

Is used to list all the containers created irrespective of its state.

I hope the above explanation would be helpful for you.

answered Sep 4, 2018 by Damon Salvatore
• 5,430 points

Related Questions In DevOps & Agile

0 votes
1 answer

How do I get a Docker container's IP address from the host?

Save your docker image as a tar ...READ MORE

answered Aug 29, 2018 in DevOps & Agile by shubham
• 6,560 points
34 views
+1 vote
2 answers

How do I run Apache server from Docker without mapping to a location?

If you're seeing a 500 error, that's ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by lina
• 8,100 points
53 views
+3 votes
2 answers

How do I set max lifetime for Docker Container?

There is one more way which you ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by Kalgi
• 36,260 points
231 views
+13 votes
5 answers

How do I run a cron job inside a docker container

If you can SSH into your server ...READ MORE

answered Jul 27, 2018 in DevOps & Agile by Kalgi
• 36,260 points
1,345 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,140 points
79 views
0 votes
1 answer
0 votes
1 answer

How do I expose multiple port with Docker?

If you want to expose only one port, ...READ MORE

answered Sep 11, 2018 in DevOps & Agile by Damon Salvatore
• 5,430 points
1,270 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.