Skip to content

Instantly share code, notes, and snippets.

@servatj
Last active July 27, 2022 10:25
Show Gist options
  • Save servatj/d8e2530335efe22c6c8bb83e02322297 to your computer and use it in GitHub Desktop.
Save servatj/d8e2530335efe22c6c8bb83e02322297 to your computer and use it in GitHub Desktop.
Completly prune your dockers

How to prune docker containers

1 - Stop all the containers

docker kill $(docker ps -q)

2 - Run a system prune

This will delete all the images with at least one container

docker system prune -a 

optional

if you don't want to delete the images you can delete all the containers with this command

docker rm $(docker ps -a -q)

optional

if you want to delete only the images that has no container asociated just do

docker rmi $(docker images -q)

or

docker system prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment