genuinetools / img

Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.
https://blog.jessfraz.com/post/building-container-images-securely-on-kubernetes/
MIT License
3.9k stars 231 forks source link

error getting credentials for push/pull #214

Open drzero42 opened 5 years ago

drzero42 commented 5 years ago

I'm on Ubuntu 18.04 and have grabbed the img binary directly from github. When I run "img pull" or "img push" for any image, both Docker Hub and others, I get an error complaining about not being able to get credentials.

$ img pull ubuntu
Pulling ubuntu...
rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: `Exhausted all available authentication mechanisms (tried: EXTERNAL) (available: EXTERNAL)`

$ img pull r.j3ss.co/stress
Pulling r.j3ss.co/stress...
rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: `Exhausted all available authentication mechanisms (tried: EXTERNAL) (available: EXTERNAL)`

It works fine with Docker:

$ docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
38e2e6cd5626: Pull complete 
705054bc3f5b: Pull complete 
c7051e069564: Pull complete 
7308e914506c: Pull complete 
Digest: sha256:945039273a7b927869a07b375dc3148de16865de44dec8398672977e050a072e
Status: Downloaded newer image for ubuntu:latest`

$ docker pull r.j3ss.co/stress
Using default tag: latest
latest: Pulling from stress
Digest: sha256:0897535c294b68e24db4d647b726ac6203cc1879bbc6b5093f677c46405cbd26
Status: Image is up to date for r.j3ss.co/stress:latest

Is this a bug in img or something to do with my system?

pwFoo commented 5 years ago

I tried to push a Image to docker hub an it fails. Tested with sucessful img login and -v $HOME/.docker:/root/.docker running inside of a docker container. So build works, but push fails.

Successfully built docker.io/<REPO>/<IMAGE>:latest
Pushing docker.io/<REPO>/<IMAGE>...
server message: insufficient_scope: authorization failed
HaveFun83 commented 4 years ago

same here. Any info how to fix this?

max3163 commented 4 years ago

Same problem here, can't pull image because of credential error :

img pull redis Pulling redis... rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: Exhausted all available authentication mechanisms (tried: EXTERNAL) (available: EXTERNAL)

So it's impossible to use this tool....

twz123 commented 3 years ago

I was able to track down the Exhausted all available authentication mechanisms (tried: EXTERNAL) (available: EXTERNAL) error down to the "credsStore": "secretservice" setting in ~/.docker/config.json. That message seems to be a D-Bus message telling that the application is not entitled to get secrets from the user's credential store. If I remove the credsStore setting and login again, the error is gone and everything works as expected.

I assume this is due to the fact that img re-executes itself and enters some namespace. When the re-execed process then tries to connect to the secret store, it does so with a different uid which is not allowed to access the passwords.

I have no idea how this could be fixed, although the workaround is to not use secretservice in conjunction with img.