内置工具
目录
Gordon 附带了一个集成的工具箱,提供对各种系统工具和功能的访问。这些工具扩展了 Gordon 的功能,使其能够与 Docker Engine、Kubernetes、Docker Scout 的安全扫描以及其他开发者实用工具进行交互。本文档涵盖了可用工具、它们的配置和使用模式。
配置
工具可以在工具箱中全局配置,使其在 Gordon 的所有界面中都可访问,包括 Docker Desktop 和 CLI。
配置方法
在 Docker Desktop 的询问 Gordon 视图中,选择输入区域左下角的
Toolbox
按钮。选择您想要启用的工具。选择卡片可以查看有关每个工具及其功能的额外信息。
有关可用工具的更多信息,请参阅参考。
使用示例
本节提供了使用 Gordon 工具执行常见操作的面向任务的示例。
管理 Docker 容器
列出并监控容器
# List all running containers
$ docker ai "Show me all running containers"
# List containers using specific resources
$ docker ai "List all containers using more than 1GB of memory"
# View logs from a specific container
$ docker ai "Show me logs from my running api-container from the last hour"
管理容器生命周期
# Run a new container
$ docker ai "Run a nginx container with port 80 exposed to localhost"
# Stop a specific container
$ docker ai "Stop my database container"
# Clean up unused containers
$ docker ai "Remove all stopped containers"
使用 Docker 镜像
# List available images
$ docker ai "Show me all my local Docker images"
# Pull a specific image
$ docker ai "Pull the latest Ubuntu image"
# Build an image from a Dockerfile
$ docker ai "Build an image from my current directory and tag it as myapp:latest"
# Clean up unused images
$ docker ai "Remove all my unused images"
管理 Docker 卷
# List volumes
$ docker ai "List all my Docker volumes"
# Create a new volume
$ docker ai "Create a new volume called postgres-data"
# Backup data from a container to a volume
$ docker ai "Create a backup of my postgres container data to a new volume"
Kubernetes 操作
# Create a deployment
$ docker ai "Create an nginx deployment and make sure it's exposed locally"
# List resources
$ docker ai "Show me all deployments in the default namespace"
# Get logs
$ docker ai "Show me logs from the auth-service pod"
安全分析
# Scan for CVEs
$ docker ai "Scan my application for security vulnerabilities"
# Get security recommendations
$ docker ai "Give me recommendations for improving the security of my nodejs-app image"
开发工作流程
# Analyze and commit changes
$ docker ai "Look at my local changes, create multiple commits with sensible commit messages"
# Review branch status
$ docker ai "Show me the status of my current branch compared to main"
参考
本节提供了您可以在 Gordon 工具箱中找到的内置工具的完整列表。
Docker 工具
与您的 Docker 容器、镜像和卷交互的工具。
容器管理
名称 | 描述 |
---|---|
list_containers | 列出所有 Docker 容器 |
remove_containers | 删除一个或多个 Docker 容器 |
stop_container | 停止运行中的 Docker 容器 |
fetch_container_logs | 从 Docker 容器检索日志 |
run_container | 运行新的 Docker 容器 |
卷管理
工具 | 描述 |
---|---|
list_volumes | 列出所有 Docker 卷 |
remove_volume | 删除 Docker 卷 |
create_volume | 创建新的 Docker 卷 |
镜像管理
工具 | 描述 |
---|---|
list_images | 列出所有 Docker 镜像 |
remove_images | 删除 Docker 镜像 |
pull_image | 从 Registry 拉取镜像 |
push_image | 将镜像推送到 Registry |
build_image | 构建 Docker 镜像 |
tag_image | 标记 Docker 镜像 |
inspect | 检查 Docker 对象 |
Kubernetes 工具
与您的 Kubernetes 集群交互的工具
Pods
工具 | 描述 |
---|---|
list_pods | 列出集群中的所有 Pods |
get_pod_logs | 获取特定 Pod 的日志 |
Deployment 管理
工具 | 描述 |
---|---|
list_deployments | 列出所有 Deployments |
create_deployment | 创建新的 Deployment |
expose_deployment | 将 Deployment 作为 Service 暴露 |
remove_deployment | 删除 Deployment |
Service 管理
工具 | 描述 |
---|---|
list_services | 列出所有 Services |
remove_service | 删除 Service |
集群信息
工具 | 描述 |
---|---|
list_namespaces | 列出所有 Namespaces |
list_nodes | 列出集群中的所有节点 |
Docker Scout 工具
由 Docker Scout 提供支持的安全分析工具。
工具 | 描述 |
---|---|
search_for_cves | 使用 Docker Scout CVEs 分析 Docker 镜像、项目目录或其他 Artifacts 以查找漏洞。搜索 cves |
get_security_recommendations | 使用 Docker Scout 分析 Docker 镜像、项目目录或其他 Artifacts,以获取基础镜像更新建议。 |
开发者工具
通用开发实用工具。
工具 | 描述 |
---|---|
fetch | 从 URL 检索内容 |
get_command_help | 获取 CLI 命令的帮助 |
run_command | 执行 shell 命令 |
filesystem | 执行文件系统操作 |
git | 执行 git 命令 |
AI 模型工具
工具 | 描述 |
---|---|
list_models | 列出所有可用的 AI 模型 |
pull_model | 下载 AI 模型 |
run_model | 使用 prompt 查询模型 |
remove_model | 移除 AI 模型 |
AI 工具 Catalog
安装了 AI 工具 Catalog Docker Desktop 扩展后,目录中所有启用的工具都可供 Gordon 使用。安装后,您可以在 Gordon 的工具箱部分启用 AI 工具 Catalog 的工具使用。