Awesome Docker tricks you need to know about!

Manpreet Singh
2 min readNov 2, 2021

Welcome back! Docker is a very powerful tool for deploying your software, if you don’t know anything about Docker, check out the link below:

Let’s talk about some awesome Docker tricks that you need to check out! Now, you may already know some of these, but you can still implement these in most projects out there!

Listing All Containers

An awesome trick with Docker is listing all of the containers that you currently have, to do this, we use the following command:

docker container ls [OPTIONS]

Removing All Stopped Containers

Next up, we all know we can stop containers by using the following command:

docker stop $(docker ps -a -q)

Well, we can actually remove all of the containers we stopped by using the following command:

docker container prune

Immediately Shutting a Container

--

--