Short script to remove docker images

  1. Create a file: remdockerimages.sh on your docker host machine
  2. Copy the below content in remdockerimages.sh
  3. #!/bin/bash
    rm imagesInfo.txt
    sudo docker images | awk ‘{print $3}’ > imagesInfo.txt
    echo “$(tail -n +2 imagesInfo.txt)” > imagesInfo.txt
    while read line; do
    sudo docker rmi “${line}”
    done < imagesInfo.txt
  4. Save the file and run ./remdockerimages.sh imagesInfo.txt
  5. Enjoy 🙂

GITHUB: https://github.com/tryinggithubnow/smalltools/blob/master/remdockerimages.sh

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s