Docker delete all images

 

In this article, we will discuss how to remove the docker images which are either active, not active, untagged, tagged with child images and etc.

The below command will delete the images which are in either in-active state or un-tagged state but can not delete the images which are inactive and tagged with child images

docker image prune

 

The below command will delete all images irrespective of the image status. It means that, clean up all images. So while performing the below command be careful. It will ask confirmation like Are you sure you want to continue? [Y/N]

So if you can confirm by pressing Y, then all images will be deleted.

docker image prune -a

We can skip the confirmation by adding the option -f

docker image prune -a -f

Output

WARNING! This will remove all images without at least one container associated to them.
Are you sure you want to continue? [y/N] Y
Deleted Images:
deleted: sha256:cfbf31d153168ef5093d718e0708beb2d3c956cbfd5902d7f4392557a180fd0a
deleted: sha256:c9720328fa6603460a0d1695417fe3bbe643d4affd878fa566035070dfdca5da
deleted: sha256:3c5713fd0b6f3ee726ce647de2ba4ea1c25b89cb10ce5368ee69ffe60f486521
deleted: sha256:ecca78b22ba400e0b292ea3848611e29858d7eb38c2966eda6669b7dc923a190
untagged: krallin/ubuntu-tini:bionic

Total reclaimed space: 1.642GB

 

 

 

 

Leave a Reply