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

Short Script to remove all stopped/exited docker containers

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

Docker Goodies

Thanks to Docker 🙂

Self-Paced Training for Docker

https://training.docker.com/self-paced-training

Docker Blogs

http://blog.docker.com (http://blog.docker.com/)

Docker Documents

http://docs.docker.com (http://docs.docker.com/)

References

https://github.com/kencochrane/docker-guidebook/blob/master/docker-guidebook.rst

https://github.com/wsargent/docker-cheat-sheet

http://www.oracle.com/technetwork/middleware/weblogic/overview/weblogic-server-docker-containers-2491959.pdf

http://linuxconfig.org/docker-container-backup-and-recovery

http://developerblog.redhat.com/2014/05/15/practical-introduction-to-docker-containers/

http://www.openstack.org/containers?gclid=CIDah9XDoMgCFVcVjgodkBADJw

http://blog.flux7.com/blogs/docker/docker-commands

Disclaimer:

All the trademarked and copyrighted content in my blog belong to their original owners and are included for representation purposes only.

A fresh start

Hi,

I’m starting this blog dedicated to DevOps and more. I’ll try to keep this site updated with the DevOps related activities that I do, posts, articles, documents, the issues which i face while working with various DevOps tools & their Solutions, suggestions etc.

Live and Let Live DevOps

MAQ