PSA docker system prune

Patrick

Administrator
Staff member
Dec 21, 2010
11,908
4,871
113
Did this on a system after a day of using a few containers on it. For those who are not aware, docker containers are lightweight, however, if you are using lots of containers especially with fuller OS base images (e.g. Ubuntu v. Alpine) containers and images can take a lot of space.

Here is an example after using a system often for 24 hours with 45.5GB reclaimed:

Code:
[root@testf ~]# docker system prune
WARNING! This will remove:
        - all stopped containers
        - all volumes not used by at least one container
        - all networks not used by at least one container
        - all dangling images
Are you sure you want to continue? [y/N] y

Deleted Containers:
a302213266eb047f9a2b65013d60fa2786995aaf5670025612dfc331f4ab6b24
b0f7ed067c25ba69e91b466efed6be51f6c9962dcdb7f825ef3ff9f7e0bc6236
1e1b705be995b12c5cad31212b7b591917495abf0ff1076879ef9fbeef5d8746
7ca923aedb5436718a977c0670d3a16b1b1ef7f212da440c79684b7b021aa365
79a40baecaa7654e490d4ebf0df4ac350d7d7d659ea4a550d280d1f0096f8974
7992ae720716cf459298cfedaabac321682188a01a287c3ee979229ad945c21d
a52b14324dd6571bf44cd89264d13c106ea8b62d2c0ca6192f698bc1aad8e85a
78bc520216311447144675f8e9f0320e381a8ced0cc22c0553b46e5bcddafe08
e5aa2ed2801e5833cfcb627469d66d482ad9bcc5c016320bc1f80d8cdef9c44a
a4cff2323a67365b237e99145d5ce4519547cbc0f81b093afb0418673001a954
1ff2b2dab0881c6fcc45a9d089121f140abcaf73e7ee29434208ad490861f97e
f116f406abc54b0a9e91fed6b4e37d0fb2033d84d4e65a5dbdde9fe5eb0a8d51
c9b1c6c22671b8751324b5e7dff0c922a801a6ac8ffa157066326b7b4e254e63
3db2ed91bbbadb5be23a05b3a0444f240f9d80330ea17e10c9b95759d861dd15
ca0ab89c0ca56c4cac35e7d6b71d1868ac4957170be01d22bcda89b99c687e01
77f52be363651655a749ef19f5372653984d288a8d7e6e4fd7c766033958de6a
e4b228621e267a2c913a198805e8251986396874cd91c7172de852ffcac29e25
fceebcac15f1ae36d09511e3f2d18a123d53c2a4b7650909d55977cbd4d69355
cb3564aa6ddeae6f2cc9de5a5dabe176bde853670e5e7e698d76afb49be5131f
468176e3eb566259c0e7c61de759e20ce95f7ae621e73258d627327c7221211f
0b8665c6b253fb5815ac552f06ecef4a8b44847342d82d35e3983314041d5a18
e1a41b6fce4c9049c88b95e93aa8a8194840076caf98d937ac7eca399d06e063
5e281e348dba265578f647f47cdfd52e1c20e6718a56491ff6393a55b6c14251
924799d28725730155b133a089f67462c1453000a5a6dc01f815820e5e57d470
e2f4eb0b1f091d59c8736afc884bc02e94ba015b7aacb62e547ca2559ee6c875
b26c205f28cd5b7d62e2c13fcee718772b9cb6e7b5fef341e14ca98dbb2bd37c
e46877cd202f3e7006a959a8a735fb4d3546ab4448033d6dac20e353326a846b
9778837bf360205fa541336c60d4326f3dbe86f394fb3c0550e21d03fced6e0c
dc18c54ea57a8d6529e7ff99c7761d1d35dcafc6e6696e70108d6ef1d424b011
20a1f0b026e8dc1e86593ad9c816655c8fc4dfb21f90a57bfc9678e012c9452b
f84e5963c55c47025b867cde0dbe3d6dc0478be137ca90123de51999a00eb749
04d223ee493afe6aab301ab92bf9c267832a276a17d2c6428c4b3e9017248d33
09746cb40e14bd7268e8e03bb340f261fa12eaa6fb89413d852d96556ebb5e60

Deleted Images:
untagged: linuxbench@sha256:2b53b4d7a7ab9c464d816bf944599109aa88112a1e94353802680286adadaf86
deleted: sha256:7e617ccbb7e9ff4dc9db71cf6d0ab00f5681e7d703f2bb852242b9599f365579
deleted: sha256:11e7be13faefab8fb9d296dbf827bd3913b5b3495d48d5e688dfbe148cdfeb63
deleted: sha256:986422b00b4b78c77e92d3f7c3fb7b2635b51460047ecc2cc5fc205b17bb6945
deleted: sha256:c57101a81927d6f5a93271b985a616db8e9b1ecf535d206784a16a53f3351416
untagged: linuxbenchs@sha256:b5e61a29e9f05436492f89a766fe8717dc70a2fd6085afbbfe6cfd1bf688b64f
deleted: sha256:84a989eb36c86a4cbf8d9e56ad455b795b6410dea826c8ae1a6ffae190427615
deleted: sha256:aa3be715d45c709f6965f3a81c3bc4e017fd7c3839769eaa1afcf8b2725c3b1f
deleted: sha256:f01b0d9007685571837cd14b271142c563a590636e27d13c639c94e2e551e06f
untagged: linuxbench@sha256:c3d715b5a5c0a8d44466c9244e0fa165ad1324f9d283b23f5418f5afd621c3a8
deleted: sha256:71a2c77d0be2816c1ba6e505c3a29cdb546e88d804838b7a862138b9fb40064f
deleted: sha256:70c38b01f46ad416fb71542fa7e364ec125ccf426e2d5f89859b0ba6bf27808a
deleted: sha256:ce7a2725d5f8390e17b2e859290d364cdb7f2ef69d0a797f23d7f4c5dbef5165
deleted: sha256:a42a3cc1cd6250ec06f7744419aaa0e20bf34bd0403e190ebf1a4ef93f2c3dd7

Total reclaimed space: 45.52GB
 

wsuff

Member
Aug 16, 2015
72
11
8
Didn't realize they added a command for this. There was some scripted ways to see what was unused and clean it up that way. Much easy this way tho.
 
  • Like
Reactions: gigatexal