Allow overriding daemon docker registry via env#591
Open
rksharma-owg wants to merge 1 commit into
Open
Conversation
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.
Problem
arctl daemon startalways initializes the compose manager with the default docker registry (localhost:5001) viadockercompose.DefaultConfig()so CI and non-local environments cannot point daemon image pulls to another registry without code changes.Root cause
In the root command wiring, the daemon manager was created with a fixed default config, and there was no environment-configurable override for
DockerRegistryin this start path.Focused solution
Add a small helper in
pkg/cli/root.gothat readsARCTL_DAEMON_DOCKER_REGISTRYfrom environment (trimmed) and applies it to the daemon compose config before constructingclidaemon.NewCommand.The default behavior remains unchanged (
localhost:5001) when the variable is unset.Files changed
pkg/cli/root.gopkg/cli/root_test.goTests added
TestDaemonManagerConfigUsesEnvOverride(verifies whitespace-trimmed env override is applied)TestDaemonManagerConfigFallsBackToDefaultRegistry(verifies default remainsversion.DockerRegistrywhen unset)Validation
go test ./pkg/cli/...make build-cli./bin/arctl daemon start./bin/arctl daemon startandARCTL_DAEMON_DOCKER_REGISTRY=registry.example.com ./bin/arctl daemon startare blocked in this environment because Docker daemon is not running, so both fail with:Cannot connect to the Docker daemon at ...before registry resolution is reached.Issue
Fixes #553
Known limitations
ARCTL_DAEMON_DOCKER_REGISTRYis supported in this patch.