Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the Nerdctl dockerresolver module happy. #2745

Merged
merged 2 commits into from
Aug 17, 2022
Merged

Conversation

ericpromislow
Copy link
Contributor

Fixes #2689

If a user is logged in, but there's no auths["https://index.docker.io/v1/"]
entry in the root's .docker/config.json file, the docker-resolver
code will get confused.

So here's how to get into the state that this change fixes:

  • Factory-reset or create a clean state
  • Start up RD in docker mode (with k8s off to speed things up)
  • docker login
  • Switch to containerd
  • nerdctl pull busybox

Without this change, you'll see an error along the lines of

FATA[0000] expected ac.ServerAddress ("") to be "https://index.docker.io/v1/"

With this change, nerdctl should proceed as usual.

Note that with no auths field in /root/.docker/config.json, running
docker login doesn't add it, but running nerdctl login does.

And if the user is logged out when the code is run, nerdctl logout
changes the field to auths: {}, but the behavior is the same for
logged out users, whether auths is empty or has an entry for
index.docker.io.

The real error here is that when a configsStore field is given in
.docker/config.json, the auths field should be ignored. Docker is
ignoring it, nerdctl isn't.

Upstream issue: github.com/containerd/nerdctl/pull/1315 with
PR 1315, but some integration tests are failing (looks like due to
flakes) and I don't see a straightforward way to provide unit tests.

Signed-off-by: Eric Promislow epromislow@suse.com

@ericpromislow ericpromislow added this to the Next milestone Aug 12, 2022
@ericpromislow
Copy link
Contributor Author

Note that this isn't top-priority because it only affects people who move from moby/docker to containerd

@ericpromislow ericpromislow marked this pull request as draft August 15, 2022 18:14
@ericpromislow
Copy link
Contributor Author

Needed for Windows too - in progress

@ericpromislow ericpromislow marked this pull request as ready for review August 15, 2022 18:59
Copy link
Contributor

@mook-as mook-as left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks generally okay, but please add comments (for both places) to indicate why this is needed; otherwise it just looks like stale code. (I realize that git blame would say things, but we should still have some comment.)

To preempt the next review — the comment should actually explain the issue, and not just a URL. Having a link to details, of course, is appreciated.

A bug in the nerdctl client expects to see an `auths` entry for
`https://index.docker.io/v1/` in `~/.docker/config.json` even
when we're getting the credentials from the `credsStore` field.

This is a workaround for upstream PR containerd/nerdctl#1315

Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
@mook-as mook-as merged commit c0cc6a7 into main Aug 17, 2022
@mook-as mook-as deleted the 2689-fix-nerdctl branch August 17, 2022 00:38
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 sometimes breaks failing to get a non-empty ServerAddress field
2 participants