DEV Community

Cover image for Useful Docker Commands
Damian Brdej
Damian Brdej

Posted on

3

Useful Docker Commands

Today I learned some docker commands, let me share it with you:

To stop all containers simply type:

docker kill $(docker ps -q)
Enter fullscreen mode Exit fullscreen mode

docker ps - list all running containers

flag -q - displays only ids of these containers

docker kill - stops containers

If you want to remove all containers use the command:

docker rm $(docker ps -a -q)
Enter fullscreen mode Exit fullscreen mode

docker rm - removes containers

flag -a - lists all containers not only running ones

The rest is similar to previous command

To remove all docker images type:

docker rmi $(docker images -q)
Enter fullscreen mode Exit fullscreen mode

docker rmi - removes images

docker images - q - lists ids of all images

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay