Skip to content

Instantly share code, notes, and snippets.

@kkbruce
Last active May 4, 2022 05:23
Show Gist options
  • Save kkbruce/b575a5c58120fdff4ff676b857a78e24 to your computer and use it in GitHub Desktop.
Save kkbruce/b575a5c58120fdff4ff676b857a78e24 to your computer and use it in GitHub Desktop.
# step 1, clean dangling image
docker rmi $(docker images -f "dangling=true" -q)
# step 2, search "before | since" images
## see "CREATED"
docker images --filter "since=baseimage"
# step 3, get IMAGE ID
docker images --filter "since=baseimage" -q
# step 3-1, Range
docker images --filter "since=baseimage" --filter "before=baseimage"
# step 4, delete "before | since" images
## if images have running container, can't delete it. don't worry.
docker rmi $(docker images --filter "since=baseimage" -q)
####################################################################
# quickly delete by baseimage
docker images baseimage
docker rmi $(docker images baseimage -q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment