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.

20 comments:

  1. 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
  2. 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
  3. 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
  4. 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
  5. I'm happy that I found this post, thanks so much!

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

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

    ReplyDelete
  8. 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
  9. thanks for sharing this post .this post is really valuable .please keep updating.https://onlineidealab.com/digital-marketing-courses-in-bangalore/

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

    ReplyDelete
  11. 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
  12. 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
  13. 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
  14. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. benchtop environmental chamber

    ReplyDelete
  15. Wow, this piece of writing is pleasant, my younger sister is analyzing these things,
    thus I am going to inform her. 풀싸롱


    ReplyDelete
  16. You are really a genius. I also run a blog, but I don't have genius skills like you. However, I am also writing hard. If possible, please visit my blog and leave a comment. Thank you. 바카라사이트


    ReplyDelete
  17. This page comprise loose WAEC expo 2022 questions and solutions. We have the excellent WAEC expo runz available in this web page. Students who wish to attain all A’s on this 12 months’s WAEC are anticipated to get 2022 WAEC expo questions and answers. Go to this web-site https://legitexpo.com.ng/2022-waec-mathematics-answers.

    ReplyDelete
  18. We understand the importance of hands-on practice. That's why our AWS Institute in Noida boasts cutting-edge labs and infrastructure, giving you the opportunity to work with AWS resources and tools in a controlled environment. This practical experience sets you on the path to mastering AWS services. Your journey with us doesn't end with certification. APTRON Solutions offers comprehensive job assistance services, including resume building, interview preparation, and placement support. Our extensive network of industry partners ensures that you have access to a wide range of career opportunities.

    ReplyDelete
  19. Unveil the secrets of Bangladesh's allure with "Bangladesh Scenic Tours." Immerse yourself in the vibrancy of Dhaka, traverse the tranquil riverine landscapes, and explore the archaeological wonders of Bishnupur. Their thoughtfully crafted tours promise an intimate encounter with the diverse facets of Beautiful Bangladesh, creating lasting memories of a truly enriching journey Tour Operator in Bangladesh.

    ReplyDelete

Popular Posts

Followers