dockeropenshift-origin

Right way to delete unused docker images on OpenShift Origin


I try to delete unused docker images on OpenShift origin. What is the right way to do this?

I tried:

docker rmi `docker images -aq`

This deleted all the unused images but I got something like this:

<none>                                           <none>              28e03c727eab        10 days ago         583.5 MB
172.30.xx.xx:5000/dev-mule/mule             <none>              d059900ab541        4 weeks ago         985.9 MB
172.30.xx.xx:5000/test-dev-mule/test-mule   <none>              d059900ab541        4 weeks ago         985.9 MB
<none>                                           <none>              80ccbf3e9509        8 weeks ago         415.8 MB
<none>                                           <none>              d2d658a63eb2        8 weeks ago         1.59 MB
<none>                                           <none>              eda6efd4df85        10 weeks ago        430 MB
<none>                                           <none>              2f0fc5db512e        10 weeks ago        711.6 MB

I have 7 running containers so this seems fine. The used images are still here.

But when I perform oc get images I got a very big list of very much images in this style:

sha256:830ed5ad3c2deab31836b1d65877c048107d0f6788daa4a36d158386000050a2   172.30.xx.xx:5000/dev-proj/proj@sha256:830ed5ad3c2deab31836b1d65877c048107d0f6788daa4a36d158386000050a2

What is the right way to delete unused images in OpenShift Origin? I'm on version oc v1.1.6


Solution

  • You should use the oc adm prune images command to remove unused images. Note that this will be conservative and not delete images that have recently been changed.

    See https://docs.openshift.org/latest/admin_guide/pruning_resources.html for more.