google-cloud-platform - GCP - 如何使用 gcloud 过滤引导磁盘?
问题描述
我正在尝试gcloud compute instances list
在一个项目上运行,并且只获取使用特定启动磁盘或映像的实例列表。我目前正在运行的是:
gcloud compute instances list --project=my-project --filter="disks.initializeParams.sourceImage='image-name'"
但是,这将返回 0 个项目,而且我遇到的任何过滤器 initializeParams 都会返回 0 个项目。我的过滤有问题吗?或者有没有更好的方法来获取使用特定图像的实例列表?
解决方案
仅使用gcloud
:
gcloud compute disks list \
--project=${PROJECT} \
--format="value(users[].basename(),sourceImage.scope())"
推荐阅读
- flutter - 如何修复 Flutter 版本解决空安全问题?
- c - 为什么您需要使用 MPI_probe 查找长度,而您还要在发送/接收函数中指示消息长度?
- c - 动态内存分配和指针相关概念疑惑
- c++ - 我陷入的竞争性编程问题
- r - 数据框列表转换因子的自定义函数
- html - 为什么我的 HTML 代码中的标签在我的浏览器上没有按顺序显示?
- python - 在 robotsframework-eclipse-python 中创建测试套件
- emacs - 如何在 Emacs 的配置文件中设置包的可执行路径?
- android - Android:无法访问 DrawerLayout 中的 MenuItem
- python - 如何创建函数以从 JSON 文件中提取数据