Skip to content

Instantly share code, notes, and snippets.

@PetreVane
Created November 19, 2021 15:59
Show Gist options
  • Save PetreVane/595de62af2eea0c32fbd213994d5803b to your computer and use it in GitHub Desktop.
Save PetreVane/595de62af2eea0c32fbd213994d5803b to your computer and use it in GitHub Desktop.
This script will remove all your local Docker images. Useful when day-dreaming of the lost drive space, because of Docker 😬
#!/bin/bash
echo "This script will delete all your local Docker images! "
docker images | cut -c 45-59 |grep -v "IMAGE ID" > /tmp/images.names
for image in $(cat /tmp/images.names); do
docker rmi -f $image;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment