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 使用。