Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud storage 谷歌云容器注册表-检查图像大小_Google Cloud Storage_Google Cloud Build_Google Cloud Registry - Fatal编程技术网

Google cloud storage 谷歌云容器注册表-检查图像大小

Google cloud storage 谷歌云容器注册表-检查图像大小,google-cloud-storage,google-cloud-build,google-cloud-registry,Google Cloud Storage,Google Cloud Build,Google Cloud Registry,我发送了一个docker文件用于谷歌云构建。已成功创建生成 工件URL为: gcr.io/XXX/api/v1:abcdef017e651ee2b713828662801b36fc2c1 如何检查图像大小?(MB\GB)没有用于此的API。但是我有一个解决办法,这个Linux命令行 curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \ https://gcr.io/v2/XXX/api/v1

我发送了一个docker文件用于谷歌云构建。已成功创建生成

工件URL为:

gcr.io/XXX/api/v1:abcdef017e651ee2b713828662801b36fc2c1


如何检查图像大小?(MB\GB)

没有用于此的API。但是我有一个解决办法,这个Linux命令行

curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  https://gcr.io/v2/XXX/api/v1/manifests/abcdef017e651ee2b713828662801b36fc2c1 2>/dev/null | \
  jq ".layers[].size" | \
  awk '{s+=$1} END {print s}'
逐行详述

  • 使用GCLOUD CLI中的安全令牌创建curl
  • 获取描述所有层及其大小的图像清单
  • 只获取层的大小
  • 合计大小

  • ->结果以字节为单位。

    不适用于我。我替换了图像url(
    https://gcr.io/...
    )与我的等价物进行比较,发现您的值与我的原始值不同。
    v2
    部分来自哪里?v2是清单版本。在这里,您只需使用它不是特定于Google的API