How do I list containers in Docker

+1 vote

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
• 7,340 points
760 views

1 answer to this question.

+1 vote

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,980 points

Related Questions In DevOps & Agile

+1 vote
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
• 7,340 points
1,024 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,220 points
2,222 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
• 52,350 points
3,641 views
+14 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
• 52,350 points
16,586 views
+2 votes
1 answer
+2 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
• 58,020 points
2,737 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,980 points
10,632 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP