Skip to content

Instantly share code, notes, and snippets.

@tmurphree
Forked from alferov/docker-rm-images.md
Last active January 10, 2019 20:33
Show Gist options
  • Save tmurphree/958b6a7378e1056d64978dc42e42d869 to your computer and use it in GitHub Desktop.
Save tmurphree/958b6a7378e1056d64978dc42e42d869 to your computer and use it in GitHub Desktop.
Remove all (untagged) images and containers from Docker

Clean up the whole mess

docker system prune

For the rest, syntax is:

  • bash
  • PowerShell

Delete all containers

docker rm $(docker ps -aq)

docker ps -aq | % { docker rm $_ }

Delete all images

docker rmi $(docker images -q)

docker images -q | % { docker rmi $_ }

Delete all untagged images

docker rmi $(docker images -q --filter "dangling=true")

docker images -q --filter "dangling=true" | % { docker rmi $_ }

References:

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