Skip to content

Instantly share code, notes, and snippets.

@sergeiwaigant
Last active November 29, 2019 10:59
Show Gist options
  • Save sergeiwaigant/954ae1ed972a4f4a62381ff1172b43db to your computer and use it in GitHub Desktop.
Save sergeiwaigant/954ae1ed972a4f4a62381ff1172b43db to your computer and use it in GitHub Desktop.
# Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
#
docker container prune
# clean up all "Exited" containers
docker rm $(docker ps -a | grep Exited | awk '{ print $1 }')

Buildah list images with JQ

buildah images --json | jq -r '.[]
buildah images --json | jq -r '.[] | select( .names == null

Cleanup old images without a tag

buildah rmi $(buildah images --json | jq -r '.[] | select( .names == null) | .id')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment