Skip to main content
Glama

ghcr_push

Tag and push Docker images to GitHub Container Registry for container deployment in DevOps workflows.

Instructions

Tag and push image to GitHub Container Registry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler logic for ghcr_push tool: constructs GHCR image tag from inputs, tags local Docker image, pushes to GHCR using docker CLI, handles tagging and push errors with helpful messages, returns formatted success response with image details and usage instructions.
    const ghcrTag = `ghcr.io/${github_owner.toLowerCase()}/${repo_name.toLowerCase()}:${tag}`; // Tag the image const tagResult = await runCommand(`docker tag ${local_image} ${ghcrTag}`); if (!tagResult.success) { return { content: [{ type: "text", text: `Failed to tag image!\n\nError: ${tagResult.error}\n\nMake sure the local image exists:\n docker images | grep ${local_image.split(":")[0]}` }] }; } // Push the image const pushResult = await runCommand(`docker push ${ghcrTag}`, { timeout: 300000 }); if (!pushResult.success) { let help = ""; if (pushResult.stderr?.includes("denied") || pushResult.stderr?.includes("unauthorized")) { help = "\n\nAuthentication failed! Run 'ghcr_login_guide' for help."; } return { content: [{ type: "text", text: `Failed to push!\n\nError: ${pushResult.stderr || pushResult.error}${help}` }] }; } return { content: [{ type: "text", text: `Successfully pushed to GHCR! Image: ${ghcrTag} View at: https://github.com/${github_owner}?tab=packages To pull this image: docker pull ${ghcrTag} To use in Kubernetes/Docker Compose: image: ${ghcrTag}` }] }; } );
  • Input schema/validation for ghcr_push tool parameters.
    local_image: { type: "string", description: "Local image name:tag" }, github_owner: { type: "string", description: "GitHub username or org" }, repo_name: { type: "string", description: "Repository/image name" }, tag: { type: "string", description: "Tag for GHCR", default: "latest" } }, async ({ local_image, github_owner, repo_name, tag }) => {
  • src/index.js:505-560 (registration)
    MCP server registration of the ghcr_push tool with name, description, schema, and handler reference.
    "ghcr_push", "Tag and push image to GitHub Container Registry", { local_image: { type: "string", description: "Local image name:tag" }, github_owner: { type: "string", description: "GitHub username or org" }, repo_name: { type: "string", description: "Repository/image name" }, tag: { type: "string", description: "Tag for GHCR", default: "latest" } }, async ({ local_image, github_owner, repo_name, tag }) => { const ghcrTag = `ghcr.io/${github_owner.toLowerCase()}/${repo_name.toLowerCase()}:${tag}`; // Tag the image const tagResult = await runCommand(`docker tag ${local_image} ${ghcrTag}`); if (!tagResult.success) { return { content: [{ type: "text", text: `Failed to tag image!\n\nError: ${tagResult.error}\n\nMake sure the local image exists:\n docker images | grep ${local_image.split(":")[0]}` }] }; } // Push the image const pushResult = await runCommand(`docker push ${ghcrTag}`, { timeout: 300000 }); if (!pushResult.success) { let help = ""; if (pushResult.stderr?.includes("denied") || pushResult.stderr?.includes("unauthorized")) { help = "\n\nAuthentication failed! Run 'ghcr_login_guide' for help."; } return { content: [{ type: "text", text: `Failed to push!\n\nError: ${pushResult.stderr || pushResult.error}${help}` }] }; } return { content: [{ type: "text", text: `Successfully pushed to GHCR! Image: ${ghcrTag} View at: https://github.com/${github_owner}?tab=packages To pull this image: docker pull ${ghcrTag} To use in Kubernetes/Docker Compose: image: ${ghcrTag}` }] }; } );

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/rideRTD/RTD-DevOps'

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