Skip to content

login: warn when the server address contains an explicit scheme - #5169

Open
locker95 wants to merge 1 commit into
containerd:mainfrom
locker95:login-warn-explicit-scheme
Open

login: warn when the server address contains an explicit scheme#5169
locker95 wants to merge 1 commit into
containerd:mainfrom
locker95:login-warn-explicit-scheme

Conversation

@locker95

@locker95 locker95 commented Sep 1, 2026

Copy link
Copy Markdown

Fixes #3052.

As noted by @fahedouch in the issue ("It looks like a bug. It is not the intended behavior."), nerdctl login silently drops an explicit scheme from the server address. Following the direction suggested by @apostasie, this change warns the user that this syntax is only supported as a convenience and that the scheme is ignored; when http:// was requested, the warning additionally points at the global --insecure-registry flag. The warning is emitted only from the login code path — dockerconfigresolver.Parse is untouched, so credential lookup during pull/push stays silent.

Testing: a platform-independent unit test covers the new detection helper (verified locally on macOS); TestLoginAgainstVariants now also asserts the warning on stderr for the scheme variants. I could only compile-verify the Linux integration test locally (GOOS=linux go build ./... / go vet / go test -c), so I am relying on CI to exercise it.

This patch was developed with the assistance of an AI tool (Claude); I have reviewed and tested the change and take responsibility for it.

`nerdctl login` accepts a server address with an explicit scheme (e.g.
`https://index.docker.io/v1/`) only as a convenience: the scheme is
silently disregarded and connections are made over https regardless,
which is surprising when the user asked for `http://`. Warn the user
that the scheme is ignored, and point at the global --insecure-registry
flag when plain http was requested. Credential lookup paths reusing
dockerconfigresolver.Parse (pull/push) are intentionally left silent.

Fixes containerd#3052

Signed-off-by: Dean Chen <862469039@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nerdctl login should warn about passing along an explicit scheme

1 participant