Sign in
Log inSign up
Cleaning up after Docker

Cleaning up after Docker

Jan Vladimir Mostert's photo
Jan Vladimir Mostert
·Apr 12, 2017

Often times you want to remove all docker images and all docker containers. When you're experimenting with images, it gets a bit painful to manually remove each image / container individually.

To remove all containers:

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

To remove all images:

docker rmi $(docker images -q)

Now when you run

docker ps -a

All containers should be gone

Running

docker images

you might still see one or two images, these will probably require the -f flag to force remove them.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct