Skip to main content
Glama

Current operating environment

getDockerInfo

Retrieve detailed Docker information for the current operating environment. Returns empty if Docker is not installed, aiding quick environment checks.

Instructions

获取当前设备的 Docker 信息,若未安装则返回空

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "required": [], "type": "object" }

Implementation Reference

  • src/index.ts:262-270 (registration)
    Registration of the getDockerInfo tool in the listTools response, including name, description, and input schema.
    { name: "getDockerInfo", description: "获取当前设备的 Docker 信息,若未安装则返回空", inputSchema: { type: "object", properties: {}, required: [] } },
  • Handler function for getDockerInfo tool. Checks if Docker is installed, fetches Docker version, images, and all containers using docker CLI commands, parses the output, and returns JSON-formatted info or empty object if not installed.
    case "getDockerInfo": { let dockerInfo = {}; try { // 检查 Docker 是否安装 execSync('docker --version'); // 获取 Docker 信息 const dockerVersion = execSync('docker version --format \'{{json .}}\'').toString(); const dockerImages = execSync('docker images --format \'{{json .}}\'').toString().split('\n').filter(Boolean).map(line => JSON.parse(line)); const dockerContainers = execSync('docker ps -a --format \'{{json .}}\'').toString().split('\n').filter(Boolean).map(line => JSON.parse(line)); dockerInfo = { version: JSON.parse(dockerVersion), images: dockerImages, containers: dockerContainers }; } catch (error) { // Docker 未安装或者出错,返回空对象 dockerInfo = {}; } return { content: [{ type: "text", text: JSON.stringify(dockerInfo, null, 2) }] }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JackXuyi/env-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server