Sunday, February 12, 2017

Quick Docker environment cleanup

Just a quick reference on my docker usage.

When working / playing with docker a lot, you quite often end up with a ton of containers and volumes laying around after they are needed...

Here are a couple tips I use to keep my environment clean.

On Windows 10
If you are using GitBash create a .bashrc and include the commands below:

alias docker-rm='docker rm $(docker ps -q -f status=exited)'
alias docker-rmi='docker rmi $(docker images -q -f dangling=true)'
alias docker-rmv='docker volume rm $(docker volume ls -q -f dangling=true)'

For MacOS X 
Add the following to your .bash_profile:

docker-rm(){
docker rm $(docker ps -q -f status=exited)
}
docker-rmv(){
docker volume rm $(docker volume ls -q -f dangling=true)
}
docker-rmi(){
docker rmi $(docker images -q -f dangling=true)
}
docker-update-all() {
docker images | awk '(NR>1) && ($2!~/none/) {print $1":"$2}'| xargs -L1 docker pull
}


Then simply run docker-rm, docker-rmi and docker-rmv to remove all the dangly bits :)

docker-update-all, is a handy way to get the latest images from docker hub.

19 comments:

  1. Apple's flagship operating system iOS 11 is nearing it's release. There will be quite a few changes from iOS 10 as well as some compatibility updates. You can check out my site to get all the details about iOS 11, the compatible devices
    iOS 11 beta

    ReplyDelete
    Replies
    1. IEEE Final Year projects Project Center in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. <Final Year Projects for CSE It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, project projects for cseAngular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Thank you for posting about these tips. Really appreciate how you have posted tips for both windows and MacOS. Do keep sharing more of these.

    ReplyDelete
  3. Globalwebsolution was Created by Award-winning Designers who believed That Technology can empower anyone to be a Designer. We use artificial intelligence, premium design assets a delightful experience to provide professional-quality design instantly And 10x Cheaper.

    ReplyDelete
  4. House fires are genuinely unfortunate and can scare encounters - you require experts to help with the recuperation and they will help sit down of your shoulders, and you can return to a typical way of life much sooner than you at any point thought conceivable.
    flood damage cleanup companies

    ReplyDelete
  5. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete
  6. We deal with all the latest technological innovations and handy gadgets that you can use on a daily basis to ease your daily work routine trivaltech.com

    ReplyDelete
  7. This way is definitely great for using, maybe I'll go this way next. But I have windows os, and time to time, I receive messages, when I can not run the apps. I found out that it may appear if the d3dx9_43.dll is missing. Solution for this bug, which I choose, is completely easy. Eliminate this error is simple enough and does not take much time, just download the d3dx9_43.dll missing https://fix4dll.com/d3dx9_43_dll file to your computer and install it into correct folder. You can download this dll-library from website completely free of charge.

    ReplyDelete
  8. I'm happy that I found this post, thanks so much!

    ReplyDelete
  9. Wonderfull keep sharing Awesome post. Thank you for the valuable information.
    Learn More

    ReplyDelete
  10. You have described all this well. That's what I meant, revelation!

    ReplyDelete
  11. You made some decent points there. I looked on the internet for the issue and found most individuals will go along with with your website. download instagram videos

    ReplyDelete
  12. I admire people who keep sharing valuable stories through great writing. I'm glad to have read this blog. Thanks and hope to read more soon. Check out Lawrence Todd Maxwell's to learn more about real estate.

    ReplyDelete
  13. thanks for sharing this post .this post is really valuable .please keep updating.https://onlineidealab.com/digital-marketing-courses-in-bangalore/

    ReplyDelete
  14. Thanks for your insight for your fantastic posting. I’m glad I have taken the time to see this. SEO Services

    ReplyDelete
  15. Thanks for making me this Blog. You have done a great job by sharing this content here.
    Keep writing blog this like.

    Best Matlab Training in kanchipuram

    ReplyDelete
  16. There are so many different types of pallet jacks to choose from it can be tricky but should you decide to opt for the Yale manual pallet jack to get your potential empire off the ground. A comfort with these and other top brands such as;  Online Docker Training

    ReplyDelete
  17. Essay writing offers many challenges for any writer. It is a complex yet rewarding task. The only real issue is get the job done writer is up to the challenge. this link

    ReplyDelete

Popular Posts

Followers