Clear Dangling Docker Containers with 1 Line

Posted on April 22, 2015 in docker, development, snippets

Tired of looking at a bunch of intermediate containers whenever your Docker build fails? Tire no more ...

docker rmi -f $(docker images --filter='dangling=true' -q)

This bad boy will force remove all intermediate, or 'dangling', containers that Docker creates. Obvious word of caution: This will remove ALL dangling containers without warning. With great power and all that.

Useful? Let me know below.


Thomas Lackemann :)


Tom is the founder of Astral TableTop. He's a homebrewer, hiker, and has an about page. Follow @tlackemann on Twitter for more discussions like this.