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 ps -q -f status=exited)
docker volume rm $(docker volume ls -q -f dangling=true)
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.


  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

  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.

  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.

  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

  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.

  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


Popular Posts