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

better failure when ~/.docker/config.json has a busted credential helper #195

Closed
vito opened this issue Jun 18, 2022 · 4 comments
Closed
Labels
cryptic A cryptic error message was returned by Bass help wanted Extra attention is needed

Comments

@vito
Copy link
Owner

vito commented Jun 18, 2022

Displayed error message

resolve failed: error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``

To Reproduce

With a bad credStore in ~/.docker/config.json, run any kind of thunk:

(run (from (linux/alpine) ($ echo "Hello")))

I'm not really sure what makes credStore become "bad" but it's a thing that can happen. Would appreciate if someone could post an example bad configuration here!

I ran into a similar error on OS X when I didn't have docker-credential-osxkeychain installed.

I suspect this is sometimes the result of bit-rotten ~/.docker/config.json from not having used Docker in a while on the machine, but letting it auto-update. Just a wild guess though. Seems like Docker is OK with the config while Bass is not.

Suggested message
What would have helped you identify the root cause quicker?

It would be great to point the user towards ~/.docker/config.json to try to clean it up, or try running a Docker command to confirm that it's broken.

@vito vito added help wanted Extra attention is needed cryptic A cryptic error message was returned by Bass labels Jun 18, 2022
@srenatus
Copy link
Contributor

Regarding "bad", that's the config I had, never having touched it myself before:

{"auths":{"ghcr.io":{},"https://index.docker.io/v1/":{}},"credsStore":"desktop","currentContext":"default","experimental":"enabled","stackOrchestrator":"swarm"}

I had changed the key to _credsStore, assuming that that would disable it, and it seemed to work fine after that change.

@srenatus
Copy link
Contributor

FWIW that executable seems to be in my PATH

$ which docker-credential-desktop                     
/usr/local/bin/docker-credential-desktop

@vito
Copy link
Owner Author

vito commented Jun 18, 2022

Great, thanks.

One thing that's probably happening here is it's choking on Bass's sanitization of the process env:

bass/pkg/bass/env.go

Lines 10 to 21 in b63ace4

func ImportSystemEnv() *Scope {
env := NewEmptyScope()
for _, v := range os.Environ() {
kv := strings.SplitN(v, "=", 2)
env.Set(Symbol(kv[0]), String(kv[1]))
}
os.Clearenv()
return env
}

So it might have been properly configured, but by the time the Buildkit runtime tried to use it the $PATH had been cleared. That's definitely a bug.

Might be worth keeping some critical env vars like $PATH around.

@vito
Copy link
Owner Author

vito commented Jul 11, 2022

fixed by #218

@vito vito closed this as completed Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cryptic A cryptic error message was returned by Bass help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants