Skip to content

Instantly share code, notes, and snippets.

@sasajib
Last active January 27, 2020 12:21
Show Gist options
  • Save sasajib/11b226e0e6394716ff89e3eb73fea880 to your computer and use it in GitHub Desktop.
Save sasajib/11b226e0e6394716ff89e3eb73fea880 to your computer and use it in GitHub Desktop.
#from post
#http://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images
#Delete stopped (exited) containers:
docker ps --no-trunc -aqf "status=exited" | xargs docker rm
#Delete unused (dangling) images:
docker images --no-trunc -aqf "dangling=true" | xargs docker rmi
#If you have exercised extreme caution with regard to irrevocable data loss, then you can delete unused (dangling) volumes (v1.9 and up):
docker volume ls -qf "dangling=true" | xargs docker volume rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment