zguz_w
Last Updated: November 10, 2016
·
37.08K
· filosottile
A336b0fe148e72a16744805d059f812a

Docker: remove all Exited containers

A oneliner!

sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm

4 Responses
Add your response

20904
Fb28cb5612fed778f232c190b85e55c6

Love the simplicity of this :)

over 1 year ago ·
21124
None

docker rm $(docker ps -q -f status=exited)

over 1 year ago ·
21126
None

@vosmith

docker rm $(docker ps --all -q -f status=exited)

over 1 year ago ·
21130
None

@miraculixx

I don't think --all can be used with -f. Usually --all would display stopped/exited containers, but with -f status=exited, it already returns those. Please correct me if I'm wrong.

over 1 year ago ·