本文档介绍了如何使用 Gemini Cloud Assist 列出您的 Artifact Registry 代码库以及存储在 Docker 格式代码库中的容器映像。
了解 Gemini for Google Cloud 如何以及何时使用您的数据。
限制
您的 Google Cloud 项目必须在组织中创建。
准备工作
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
- 如果您没有在 Artifact Registry 代码库中存储任何容器映像,请按照在 Artifact Registry 中存储 Docker 容器映像中的说明进行操作。
- 确保已为您的 Google Cloud 用户账号和项目设置了 Gemini Cloud Assist。
- 确保您拥有必要的 Identity and Access Management (IAM) 权限,以便完成本文档中的任务。
所需的角色
如需获得列出 Artifact Registry 中的代码库和容器映像所需的权限,请让您的管理员为您授予项目或代码库的 Artifact Registry Reader (roles/artifactregistry.reader
) IAM 角色。
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
打开 Gemini Cloud Assist 对话
您可以打开 Cloud Assist 面板,以便在 Google Cloud 控制台中的任何位置使用 Gemini Cloud Assist 聊天。
- 在 Google Cloud 控制台中,选择一个在 Artifact Registry 中存储了容器映像的项目。
- 如需打开 Cloud Assist 面板,请点击 spark 打开或关闭 Gemini AI 对话。
- 如需输入提示,请键入提示,然后点击发送 发送提示。
列出代码库
您可以提示 Gemini Cloud Assist 列出当前项目中的代码库,并按以下条件过滤回答:
- 位置(必需)。您要列出的代码库的位置。
- 标签(可选)。标签是用于整理资源的键值对。
- 标记(可选)。标记用于对 Google Cloud 中的代码库和其他资源进行分组,以便在 Google Cloud 组织内进行报告、审核和访问权限控制。
如需列出代码库,请执行以下操作:
在 Gemini Cloud Assist 对话中,输入以下提示:
List repositories in the location LOCATION
将
LOCATION
替换为代码库的位置,例如us-west1
。例如,以下提示要求 Gemini Cloud Assist 列出区域
us-west1
中具有标签env:dev
的代码库:List repositories for us-west1 with the label env:dev
响应包含指定位置中具有标签
env:dev
的代码库列表。
列出容器映像
您可以提示 Gemini Cloud Assist 列出当前项目中 Docker 格式的代码库中的容器映像,并按以下条件过滤回答:
- 代码库 ID(必需)。代码库 ID。
- 位置(必需)。您要列出映像的代码库的位置。
- 标签(可选)。标签是用于整理资源的键值对。
- Docker 标记(可选)。当您将映像推送到代码库或从代码库拉取映像时,可以使用 Docker 标记来指定映像的版本。
如需列出代码库中的映像,请执行以下操作:
在 Gemini Cloud Assist 对话中,输入以下提示:
List my images for REPOSITORY in LOCATION with the tag TAG
替换以下内容:
- REPOSITORY:代码库 ID
- LOCATION:代码库的位置,例如
us-west1
- TAG:Docker 标记,例如
latest
响应包含具有指定标记、代码库和位置的图片列表。
后续步骤
- 详细了解 Gemini Cloud Assist。