Docker for Girls - Understanding docker ps Once and For All
Hey girls! π
If youβre as passionate about IT and Docker as I am but sometimes find it a bit complicated, donβt worry! Today, Iβll explain the super-important docker ps command in a way that anyone can understand! π
π What is docker ps
?
This command shows all the containers on your computer. It tells you which ones are running, which ones are stopped, and what their settings are. Think of docker ps
as your list of all containersβjust like a list of open tabs in your browser. π₯οΈ
π§ When Should You Use docker ps
?
You use docker ps
when you want to:
- See which containers are currently running.
- Find out which containers have stopped.
- Get the ID or name of a container.
- Check which ports are open.
- View the size of a container.
- Check if a container is healthy (yes, containers can have bad days too!).
β¨ How to Use docker ps
(Examples)
π The Simplest Command:
docker ps
Shows only running containers.
π Want to See All Containers, Even Stopped Ones?
docker ps -a
Now you can see both running and stopped containers. The STATUS column will show why a container stopped (e.g., due to an error or just being turned off).
π How to View the Last Created Container?
docker ps --latest
Great for checking if the most recently created container is working properly.
π How to Check How Much Space a Container is Using?
docker ps -s
This helps when your disk space is running low. π§Ή
π How to See Only Container IDs?
docker ps -q
Useful when you need container IDs without extra details.
π Filtering docker ps
To quickly find the container you need, use filters:
π Find a container with a specific label:
docker ps --filter label=app=my-app
π Show containers created before a specific one:
docker ps --filter before=my-app-container
π Find containers using a specific volume:
docker ps --filter volume=my-volume
π See containers in a specific network:
docker ps --filter network=my-network
π How to Change docker ps
Output?
By default, docker ps
outputs a table, but you can customize what is displayed:
{% highlight shell %} docker ps βformat βtable {{.ID}}\t{{.Image}}\t{{.Status}}β {% endhighlight %}
This will show only the container ID, image, and status.
Want JSON format? Easy:
docker ps --format json
π Pro Tips!
β¨ Donβt forget about -a
: If a container stops, docker ps
wonβt show it by default, so use docker ps -a
.
β¨ Set up your favorite commands: For convenience, create aliases for frequently used commands.
β¨ Monitor container sizes: Keep only the necessary containers to avoid wasting disk space.
π― Conclusion
The docker ps
command is your go-to tool for managing containers. Now you know how to check which containers are running, which have stopped, and how to filter them. Easy, right? π
I hope this guide helped! If you have any questions, feel free to askβIβm always happy to chat about Docker. π»π
See you soon, IT girl! π
Refill My Coffee Supplies
π PayPal
π Patreon
π GitHub
π₯€ BuyMeaCoffee
πͺ Ko-fi
Follow Me
π¬ YouTube
π¦ X / Twitter
π¨ Instagram
π Mastodon
π§΅ Threads
πΈ Facebook
π§ Bluesky
π₯ TikTok
π» LinkedIn
π GitHub
Is this content AI-generated?
Absolutely not! Every article is written by me, driven by a genuine passion for Docker and backed by decades of experience in IT. I do use AI tools to polish grammar and enhance clarity, but the ideas, strategies, and technical insights are entirely my own. While this might occasionally trigger AI detection tools, rest assuredβthe knowledge and experience behind the content are 100% real and personal.