Gordon 中的内置工具

Gordon 包含一个集成的工具箱,可让您访问系统工具和功能。这些工具扩展了 Gordon 的功能,使您可以与 Docker Engine、Kubernetes、Docker Scout 安全扫描以及其他开发人员实用程序进行交互。本文介绍了可用工具、如何配置它们以及使用模式。

配置工具

在工具箱中全局配置工具,使其在整个 Gordon 中可用,包括 Docker Desktop 和 CLI。

配置工具

  1. 在 Docker Desktop 的 **询问 Gordon** 视图中,选择输入区域左下角的 **工具箱** 按钮。

    Screenshot showing Gordon page with the toolbox button.
  2. 要启用或禁用某个工具,请在左侧菜单中选择它,然后选择切换按钮。

    Screenshot showing Gordon's Toolbox.

    有关 Docker 工具的更多信息,请参阅参考

使用示例

本节展示了您可以使用 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"

# Back up 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 容器、镜像和卷进行交互。

容器管理

名称描述
docker访问 Docker CLI
list_builds列出 Docker 守护程序中的构建
build_logs显示构建日志

卷管理

工具描述
list_volumes列出所有 Docker 卷
remove_volume删除 Docker 卷
create_volume创建新的 Docker 卷

镜像管理

工具描述
list_images列出所有 Docker 镜像
remove_images删除 Docker 镜像
pull_image从注册表拉取镜像
push_image将镜像推送到注册表
build_image构建 Docker 镜像
tag_image标记 Docker 镜像
inspect检查 Docker 对象

Kubernetes 工具

与您的 Kubernetes 集群进行交互。

Pod 管理

工具描述
list_pods列出集群中的所有 Pod
get_pod_logs获取特定 Pod 的日志

部署管理

工具描述
list_deployments列出所有部署
create_deployment创建新部署
expose_deployment将部署公开为服务
remove_deployment删除部署

服务管理

工具描述
list_services列出所有服务
remove_service删除服务

集群信息

工具描述
list_namespaces列出所有命名空间
list_nodes列出集群中的所有节点

Docker Scout 工具

由 Docker Scout 提供支持的安全分析。

工具描述
search_for_cves使用 Docker Scout CVEs 分析 Docker 镜像、项目目录或其他工件是否存在漏洞。
get_security_recommendations使用 Docker Scout 分析 Docker 镜像、项目目录或其他工件以获取基础镜像更新建议。

开发人员工具

通用开发实用程序。

工具描述
fetch从 URL 检索内容
get_command_help获取 CLI 命令的帮助
run_command执行 shell 命令
filesystem执行文件系统操作
git执行 git 命令

AI 模型工具

工具描述
list_models列出所有可用的 Docker 模型
pull_model下载 Docker 模型
run_model使用提示查询模型
remove_model删除 Docker 模型

Docker MCP 目录

如果您已启用 MCP Toolkit 功能,则所有已启用和配置的工具都可供 Gordon 使用。

© . This site is unofficial and not affiliated with Kubernetes or Docker Inc.