docker_list_images
List local Docker images with repository, tag, and size information to manage container infrastructure.
Instructions
List local Docker images with repository, tag, and size
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all | No | Show all images including intermediate |
Implementation Reference
- src/tools/docker/images.ts:4-27 (handler)The actual implementation of the tool 'docker_list_images'.
export async function listImages(args: Record<string, unknown>): Promise<string> { const docker = getDockerClient(); const images = await docker.listImages({ all: (args.all as boolean) || false }); if (images.length === 0) { return "No images found."; } const headers = ["REPOSITORY:TAG", "IMAGE ID", "SIZE", "CREATED"]; const rows = images.map((img) => { const tags = (img.RepoTags || ["<none>"]).join(", "); const created = new Date(img.Created * 1000); const age = Math.floor((Date.now() - created.getTime()) / 86400000); return [ tags, img.Id.replace("sha256:", "").substring(0, 12), formatBytes(img.Size), `${age}d ago`, ]; }); return `Docker images:\n\n${formatTable(headers, rows)}`; } - src/tools/docker/index.ts:53-62 (registration)Registration of the 'docker_list_images' tool with its input schema.
{ name: "docker_list_images", description: "List local Docker images with repository, tag, and size", inputSchema: { type: "object" as const, properties: { all: { type: "boolean", description: "Show all images including intermediate" }, }, }, },