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

Prune unused images in OpenShift Origin 1.1.6

我尝试删除集群上未使用的映像。一些未使用的图像在我的节点上。其中一些图像也仍在我的注册表中。 (它们是图像的先前版本)。所以现在我想删除我的节点和我的 openshift 注册表中未使用的旧图像。

首先我尝试了 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)。我也不知道它是否通常会删除我节点上未使用的图像或同时删除我注册表中的图像?

OpenShift 会自动删除不再使用的单个机器上未使用的映像,尽管删除它们的积极程度或速度取决于节点上需要多少磁盘。您可以使用 https://docs.openshift.com/enterprise/3.1/admin_guide/garbage_collection.html#image-garbage-collection

调整每台机器上的设置

修剪命令将清除未引用的图像,但相当保守。只会删除较旧的图像 - 请参阅 https://docs.openshift.com/enterprise/3.1/admin_guide/pruning_resources.html 以更深入地讨论这些标志。