在OpenShift Origin 1.1.6中修剪未使用的图像

我尝试删除群集上未使用的图像。 一些不使用的图像在我的节点上。 其中一些图像也在我的registry中。 (他们是一个图像的以前的版本)。 所以现在我想删除未使用的旧图像,在我的节点和我的openshiftregistry中。

首先我尝试了docker的方式:

docker images -q |xargs docker rmi 

但后来我得到了一些东西:

 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 172.30.xx.xx:5000/proj/image <none> 8b447558582d 18 hours ago 567.1 MB <none> <none> a8cf2d4c61d0 2 days ago 439.4 MB <none> <none> b89dba477f35 6 days ago 699.8 MB <none> <none> 07e013fb74a4 8 days ago 225.8 MB 

oc get images显示了一些图层。 我试图修剪图像与命令oadm prune images (没有确认),但比我得到:

 I0421 07:34:10.872320 42525 imagepruner.go:430] Unable to find image "sha256:7a28aee39fd0e7097f566d6292ff1x7302aa9c049e00f2e5aa48bdb66346a717" in the graph I0421 07:34:10.872436 42525 imagepruner.go:430] Unable to find image "sha256:c21e91864b4cd05fa0b8feab124x3b95f313456dba32ce3d6ad9f6a7a31a9074" in the graph I0421 07:34:10.872460 42525 imagepruner.go:430] Unable to find image "sha256:09654488a537e791a8d17403c067x8b49a26b7d72239ed7a3fcd313d34747b19" in the graph I0421 07:34:10.872501 42525 imagepruner.go:430] Unable to find image "sha256:0404ab93a5a48fbf068c88c2fx6a473db171be88ae16a493dcf8dc43d946a177" in the graph I0421 07:34:10.872511 42525 imagepruner.go:430] Unable to find image "sha256:4ac3571f302ee97xdb35cc05008d2f037890d120b44958f85c4392e4ddffb21a" in the graph I0421 07:34:10.872984 42525 imagepruner.go:430] Unable to find image "sha256:7a28aee39fx0e7097f566d6292ff157302aa9c049e00f2e5aa48bdb66346a717" in the graph 

我看到图像层sha256 …还执行oc get images命令,所以它真的在那里。

它没有删除(也用–confirm)。 我也不知道它通常会删除我的节点上的未使用的图像,或者也删除我的registry中的图像?

OpenShift会自动删除不再使用的单个机器上未使用的映像,尽pipe它们被删除的速度取决于节点上需要多less磁盘。 您可以使用https://docs.openshift.com/enterprise/3.1/admin_guide/garbage_collection.html#image-garbage-collection调整每台机器上的设&#x7F6E;

prune命令将清除未引用的图像,但是相当保守。 只有较旧的图片才会被删除 – 请参阅https://docs.openshift.com/enterprise/3.1/admin_guide/pruning_resources.html以获得有关标志的更深入讨论&#x3002;