使用 roxctl CLI 进行镜像扫描

您可以使用 roxctl CLI 扫描存储在镜像注册表中的镜像,包括集群本地注册表,例如 Alauda 容器平台集成的镜像注册表。

INFO

镜像扫描需要适当的权限和对注册表及 Central 的网络访问。

目录

在远程集群中扫描镜像

运行以下命令以扫描指定的镜像

roxctl image scan \
  --image=<image_registry>/<image_name> 
  • 对于 <image_registry>,指定镜像所在的注册表,例如 image-registry.alauda-image-registry.svc:5000/

示例输出

{
  "Id": "sha256:3f439d7d71adb0a0c8e05257c091236ab00c6343bc44388d091450ff58664bf9",
  "name": {
    "registry": "image-registry.alauda-image-registry.svc:5000",
    "remote": "default/image-stream",
    "tag": "latest",
    "fullName": "image-registry.alauda-image-registry.svc:5000/default/image-stream:latest"
  }
  // ...
}
  • Id: 镜像的唯一标识符,作为完整性和真实性的指纹。
  • name.registry: 镜像注册表位置。
  • name.remote: 镜像的远程路径。
  • name.tag: 镜像的版本或标签。
  • name.fullName: 镜像的完整名称(注册表、路径、标签)。

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