Fix: Enable Docker authentication for custom image registries (#39)#1041
Open
Nikky000 wants to merge 1 commit intodocker:mainfrom
Open
Fix: Enable Docker authentication for custom image registries (#39)#1041Nikky000 wants to merge 1 commit intodocker:mainfrom
Nikky000 wants to merge 1 commit intodocker:mainfrom
Conversation
Fixes docker#39 - Added environment variable inheritance to docker pull commands - Updated internal/mcp/client.go to use os.Environ() - Updated cmd/build/main.go to use buildDockerEnv() This allows docker pull to access host authentication credentials when pulling images from private registries like ghcr.io
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #39
Problem
Users were unable to pull custom Docker images from private registries (e.g.,
ghcr.io) when using the MCP registry. The error encountered was:pulling docker image ghcr.io/my-image: Error response from daemon: error from registry: denied
Even though users were authenticated locally and could run
docker pullmanually, the MCP registry code could not access their Docker credentials.Root Cause
Docker pull commands executed via
exec.Commandwere not inheriting environment variables from the host system. Docker relies on environment variables (PATH, HOME, etc.) to locate authentication credentials stored in~/.docker/config.json.Solution
Added environment variable inheritance to docker pull commands in two locations:
internal/mcp/client.go- Modified theStart()method to useos.Environ()when pulling imagescmd/build/main.go- UpdatedpullCommunityImage()to use the existingbuildDockerEnv()helperThis allows Docker to access host authentication credentials when pulling from private registries.
Changes
osimport tointernal/mcp/client.goclient.Start()to inherit environment variablespullCommunityImage()to usebuildDockerEnv()for consistencyTesting
go build ./...go test ./...Backward Compatibility
This change maintains full backward compatibility. Public images continue to work as before, while private images now work as expected when users are authenticated.