Removing images
Modified: 28 Apr 2022 01:26 UTC
Remove a single image
To remove a single image, execute imgadm delete
with the UUID of the image you wish to remove.
[root@cnode01 (cak-1) ~]# imgadm delete f612a89c-78eb-cc2a-ac79-29280b9f3eb7
Deleted image f612a89c-78eb-cc2a-ac79-29280b9f3eb7
Removing unused images
Having a large number of unused image files will occupy a large amount of disk space. It's important to occasionally clean up and remove those files.
The command imgadm vaccum
is designed to remove those unused image files and is documented fully on the man page.
To check how many images will be removed, you can perform a dry run with imgadm vacuum -n -f
.
[root@cnode01 (cak-1) ~]# imgadm vacuum -n -f
[dry-run] Deleted image f612a89c-78eb-cc2a-ac79-29280b9f3eb7 (docker-layer@c40e708042c6)
[dry-run] Deleted image f047f02e-7f0d-014d-5750-c7a092165164 (docker-layer@8243b36f9bd4)
It is also possible to use Zabbix or another monitoring solution to check the number of unused images.
With imgadm vacuum
, you will be prompted to delete all unused images:
[root@cnode01 (cak-1) ~]# imgadm vacuum
This will delete the following images:
f612a89c-78eb-cc2a-ac79-29280b9f3eb7 (docker-layer@c40e708042c6)
f047f02e-7f0d-014d-5750-c7a092165164 (docker-layer@8243b36f9bd4)
Delete these 2 images? [y/N]