Manuel Bauer

Docker: Remove stopped containers and unused images

Docker version 1.25 introduced a new command to clean up stopped containers, unused images and more.

With one command it is possible to reclaimed unnecessary space occupied by docker.

docker system prune

Additional, if all unused images should be removed just execute with parameter -a for a full cleanup.

docker system prune -a

Example output:

~ $ docker system prune
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
35b9871db2de2401958bd2ad302ca7615c5951c26b916d51ba72775901e4cb6c
cf3ac1a3797a64b9f66b00d0ce03b955f142d1f9e84354cfcd19301190add2f4
9494255a64af914ee2753e16f59c672e29101df85ad43ec2cbc342ef3471cee6
68da702c61f6994956f4427414714c229c121507e1550b9208b948407d62e806
a3d337a28b1ad3997f37f53edcd7813081b54fcd14fe862491f67d1943a2b57c
0b60e92257db4604d5722f7ee45da3ca89d177bd66625c455f9a5ca70fe9ee97
e7124d7463bced103a20c3a01d9ecff0418a8e69e3b3602e8953079519e6576d
376ef54f92bca46812be17897c437a6f867efbc2718db6b013c6320034bc9916
afdd82922e65a721a48ad58b5a5b3d4f7246e112b16c10a9167fed54b82aebe4

Deleted Images:
deleted: sha256:0f40fc30c84e2b5a9fab7c4e670051329058d9fb4018aed8576baa73cf5b9eba
deleted: sha256:febd1d83846cfe3337d53a87db593fbbfe163b2005d9080af8689a0345ae2118
deleted: sha256:a8870dddb45305f418a33e6db5f4c656d6dcb0ebf7486d826c5ab17684f4a36e
deleted: sha256:ff9155f21b3220d70cdcf875438cae1901ff465814a55235584fb7ed260a4ed8
deleted: sha256:deee6e7002dc92e3814bb4f86ee8980a83f565a62fb68cbb68bf2713ca1cd55a
deleted: sha256:ec52cc138bd37187a6cd7060176f243f471e7ffc3cd74ef74df5746ebc529fe0
deleted: sha256:4c8a4f89ad51b755da8707efded8aa4ead100506d124f6a3733b6f04b748c851
deleted: sha256:bcc02f13f98cf24d711d5179f9c2abefcd47df2281cab336ada189f90837ad8b
deleted: sha256:dca4b87255c2fa63de08593fa760b56b9b72f79d9537d61d92e548ea79fe2a01
deleted: sha256:e1fb0a312663b26c36b705c95058b88859fcc738d534c5701908866947f6133b
deleted: sha256:9e8bbe5798a72f9356700e7ea8eb380f063c3842f469c7e76a7ffa67de41d005
deleted: sha256:05693bfc7a1fe53d88ea4717c976ea0769a95931d8a13bb19183284f0abc1243
deleted: sha256:04f146b3df036148964510c274a97f8f09a29ecfbad0ba3be9941d3f238158a5
deleted: sha256:a13a0071d69e643f415c573da7c2b5065ae49b31ee1b5c7401ef50484fceec00
deleted: sha256:4c06c631c5016fc20b0ff277725d29fef533d6b87d19978a6c2f36f1822b3ad7
deleted: sha256:5e5e2ff761eb39e6199a12d1ed0ac04d85c1dc566b75a0f2b9a38f7a314bef62
deleted: sha256:84954f02381b75bf230a4177634ec73d9ee10dca743100407a80c1c5f62faed4

Total reclaimed space: 509.4MB