Enable both public and private repository for pulling image during bootBuildImage #24549
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.
As described in #24547, if using runImage in private registry which was built upon images in public registry, image pulling would fail because apply a basic auth on no-auth-required public registry.
Take the following configuration as explanation, basic auth should only be applied when the image tag was prefixed with
docker.example.com/
, should never be applied when the parent images of this image was belong todocker.io
.The solution is quite simple:
registryUrl
inDockerConfiguration
, and save the url into it during the construction.domain
was contained inregistryUrl
, if so, apply the basic auth, otherwise do not apply.This only support
username/password
authentication, not fortoken
authentication beause it doesn't provide an url.