×

您可以使用 `roxctl` CLI 扫描存储在镜像注册表中的镜像,包括集群本地注册表,例如 OpenShift Container Platform 集成的镜像注册表。

使用远程集群扫描镜像 (Scanning images by using a remote cluster)

通过在委托扫描配置中指定相应的集群或通过以下步骤中描述的集群参数,您可以使用远程集群扫描集群本地注册表中的镜像。

有关如何配置委托镜像扫描的更多信息,请参阅 配置委托镜像扫描 (Configuring delegated image scanning)

步骤 (Procedure)
  • 运行以下命令以在远程集群中扫描指定的镜像:

    $ roxctl image scan \
      --image=<image_registry>/<image_name> \(1)
      --cluster=<cluster_detail> \(2)
      [flags] (3)
    1 对于 `<image_registry>`,请指定镜像所在的注册表,例如 `image-registry.openshift-image-registry.svc:5000/`。对于 `<image_name>`,请指定要扫描的镜像名称,例如 `default/image-stream:latest`。
    2 对于 `<cluster_detail>`,请指定远程集群的名称或 ID。例如,指定名称 `remote`。
    3 可选:对于[flags],您可以指定参数来修改命令的行为。

    有关可选参数的更多信息,请参阅roxctl image scan 命令选项

    示例输出
    {
      "Id": "sha256:3f439d7d71adb0a0c8e05257c091236ab00c6343bc44388d091450ff58664bf9", (1)
      "name": { (2)
        "registry": "image-registry.openshift-image-registry.svc:5000", (3)
        "remote": "default/image-stream", (4)
        "tag": "latest", (5)
        "fullName": "image-registry.openshift-image-registry.svc:5000/default/image-stream:latest" (6)
      },
    [...]
    1 图像的唯一标识符,用作图像的指纹。它有助于确保图像的完整性和真实性。
    2 包含有关图像的具体详细信息。
    3 存储图像的镜像仓库位置。
    4 图像的远程路径。
    5 与此图像关联的版本或标签。
    6 图像的完整名称,结合了注册表、远程路径和标签。

roxctl image scan 命令选项

roxctl image scan 命令支持以下选项

选项 描述

--cluster string

将镜像扫描委托给特定集群。

--compact-output

以紧凑格式打印 JSON 输出。默认值为false

-f, --force

忽略 Central 的缓存以进行扫描,并强制从 Scanner 重新拉取最新数据。默认值为false

--headers strings

以表格格式打印标题。默认值包括COMPONENTVERSIONCVESEVERITYLINK

--headers-as-comments

在 CSV 表格输出中将标题作为注释打印。默认值为false

-h, --help

查看roxctl image scan命令的帮助文本。

-i, --image string

指定要扫描的镜像名称和引用。

-a, --include-snoozed

返回已暂停和未暂停的常见漏洞和披露 (CVE)。默认值为false

--merge-output

合并表格输出中的重复单元格。默认值为true

--no-header

不为表格格式打印标题。默认值为false

-o, --output string

指定输出格式。您可以选择一种格式来自定义结果的显示方式。格式包括tableCSVJSONSARIF

-r, --retries int

设置在操作因错误中止之前的重试次数。默认值为3

-d, --retry-delay int

设置重试之间等待的时间(秒)。默认值为3

--row-jsonpath-expressions string

使用 JSON 路径表达式从 JSON 对象创建行。有关更多详细信息,请运行roxctl image scan --help命令。