Skip to main content
Glama

docker_registry

Search Docker Hub, authenticate, and manage container images with push, pull, and tagging operations for Docker registry workflows.

Instructions

Search Docker Hub, login/logout, push/pull operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesRegistry action to perform
queryNoSearch query (required for search)
imageNoImage name (required for push, pull, tag)
tagNoImage tag
newTagNoNew tag name (required for tag action)
registryNoRegistry URL (optional for login/logout)
usernameNoUsername for login
passwordNoPassword for login

Implementation Reference

  • Handler function implementing Docker registry operations: search, login, logout, push, pull, tag. Constructs docker commands based on action and parameters, executes via executeDockerCommand, and returns formatted results or errors.
    async ({ action, query, image, tag, newTag, registry, username, password }) => { try { let command: string; switch (action) { case "search": if (!query) throw new Error("Search query is required"); command = `docker search ${query}`; break; case "login": command = `docker login${registry ? ` ${registry}` : ""}`; if (username && password) { command += ` -u ${username} -p ${password}`; } break; case "logout": command = `docker logout${registry ? ` ${registry}` : ""}`; break; case "push": if (!image) throw new Error("Image name is required for push"); command = `docker push ${image}${tag ? `:${tag}` : ""}`; break; case "pull": if (!image) throw new Error("Image name is required for pull"); command = `docker pull ${image}${tag ? `:${tag}` : ""}`; break; case "tag": if (!image || !newTag) throw new Error("Image name and new tag are required for tag action"); command = `docker tag ${image}${tag ? `:${tag}` : ""} ${newTag}`; break; } const result = await executeDockerCommand(command); return { content: [ { type: "text", text: `Registry ${action} completed:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error with registry operation: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
  • Input schema defining parameters for docker_registry tool: action (enum), query, image, tag, newTag, registry, username, password with Zod validation and descriptions.
    "docker_registry", { title: "Docker Registry Operations", description: "Search Docker Hub, login/logout, push/pull operations", inputSchema: { action: z.enum(["search", "login", "logout", "push", "pull", "tag"]).describe("Registry action to perform"), query: z.string().optional().describe("Search query (required for search)"), image: z.string().optional().describe("Image name (required for push, pull, tag)"), tag: z.string().optional().describe("Image tag"), newTag: z.string().optional().describe("New tag name (required for tag action)"), registry: z.string().optional().describe("Registry URL (optional for login/logout)"), username: z.string().optional().describe("Username for login"), password: z.string().optional().describe("Password for login") }
  • src/index.ts:1658-1729 (registration)
    Registration of the 'docker_registry' tool with McpServer using server.registerTool, including title, description, inputSchema, and handler function.
    // Register Docker registry and search tool server.registerTool( "docker_registry", { title: "Docker Registry Operations", description: "Search Docker Hub, login/logout, push/pull operations", inputSchema: { action: z.enum(["search", "login", "logout", "push", "pull", "tag"]).describe("Registry action to perform"), query: z.string().optional().describe("Search query (required for search)"), image: z.string().optional().describe("Image name (required for push, pull, tag)"), tag: z.string().optional().describe("Image tag"), newTag: z.string().optional().describe("New tag name (required for tag action)"), registry: z.string().optional().describe("Registry URL (optional for login/logout)"), username: z.string().optional().describe("Username for login"), password: z.string().optional().describe("Password for login") } }, async ({ action, query, image, tag, newTag, registry, username, password }) => { try { let command: string; switch (action) { case "search": if (!query) throw new Error("Search query is required"); command = `docker search ${query}`; break; case "login": command = `docker login${registry ? ` ${registry}` : ""}`; if (username && password) { command += ` -u ${username} -p ${password}`; } break; case "logout": command = `docker logout${registry ? ` ${registry}` : ""}`; break; case "push": if (!image) throw new Error("Image name is required for push"); command = `docker push ${image}${tag ? `:${tag}` : ""}`; break; case "pull": if (!image) throw new Error("Image name is required for pull"); command = `docker pull ${image}${tag ? `:${tag}` : ""}`; break; case "tag": if (!image || !newTag) throw new Error("Image name and new tag are required for tag action"); command = `docker tag ${image}${tag ? `:${tag}` : ""} ${newTag}`; break; } const result = await executeDockerCommand(command); return { content: [ { type: "text", text: `Registry ${action} completed:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error with registry operation: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );

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/TauqeerAhmad5201/docker-mcp-extension'

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