Docker clean up containers

March 29th, 2017 Posted by Blog, DevOps, Tips 0 thoughts on “Docker clean up containers”
docker rm $(docker ps -a -q)
f38620892705
f2552096d321
fd2ca29b696b
c4f9ee6ee14b
f92b7b816bad
e44f71995064
e0c2599ea085
0c032d72b339

Since docker 1.13, use the prune command, it is also available for image, volume and network.

docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] Y
Deleted Containers:
08e4f5a8373f495d4ca1eeb5db09d25d22716b3d4c2b28636230935feb2cad1d
354a554f84701d51febd817a7fac437925b885a165076d4fbe6d360af39d3e5f
4b2318ceb2001542f3f4b2df8bbe0b0ca6818f8604a00e3df72e464cf599c902
8011c4439ec92b2f46b07741f21f5d43fae1282b953983432a0ae22d6f904635
Total reclaimed space: 0 B

If you want to clean everything in one time :

docker system prune

Continuous S.A.
Avenue des Hauts-Fourneaux 9
L-4362 Esch-sur-Alzette
Luxembourg

© Continuous S.A. 2017