-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Private registry, no login prompt #19159
Comments
I'm curious if this works as expected pre- #18590. There were some error handling changes there. What about with 1.9? Another relevant change could be 31cdc63. I'm a bit suspicious of the way this flattens errors into strings. Maybe before the client got a HTTP-level error, and now it just gets an error string. |
I'll test with 1.9 (not sure right now) |
I tried this with master and 1.9 and neither one prompts me for a login. So at least this doesn't seem like a regression from 1.9. |
Alright, but I see there's a code path which should prompt for a login (afk now) |
@aaronlehmann I thought the first attempt to pull would raise a 401 and go on from here https://github.com/docker/docker/blob/master/vendor/src/github.com/docker/engine-api/client/image_pull.go#L23 and ask for credentials but somehow it isn't happening (haven't dug yet enough) |
What I don't know is where the daemon is supposed to return a 401 HTTP status to the client. Maybe some code existed to do this in some previous version. Now it just returns the error in the HTTP body as JSON: https://github.com/docker/docker/blob/master/api/server/router/local/image.go#L179 |
it seems from this log that the first is a 401, then a retry is performed (the first 401 error isn't returned but just saved), and the retry returns a 500 which will fail the if condition to login. Could it be like I said? (didn't check, but I remember errors are kind of stacked before returning them to the cli) |
But even without the retry, I don't see anything that would pass the 401 status through to the client. |
So if the code is there I suppose it was once working, maybe 1.8 or maybe support for login prompt was dropped and that's just dead code |
also errors are different between private and public registry:
Not sure I can get not authorized with official registry but from private with latest master code:
|
We also saw this in our CI, when pushing to our private registry. The situation was like the following: Two jobs built the latest image of i.e While the build process is isolated by custom I was able to watch the push, but for the last layers Sorry, no logs or |
@aaronlehmann @tonistiigi @calavera I tried this with 1.9 and this seems really a regression cause in 1.9 docker prompted for user+pass when pushing/pulling |
I discussed this with @runcom a little and it sounds like the problem was related to the token server mock not returning a proper JSON error body. The push/pull code switches on So it sounds to me like there's no regression when the token server is returning well-formed errors, but we could certainly do better in cases where we only have a status code. I'll open a ticket or PR against |
What about |
I've setup a private registry with TLS and auth from the official
registry:2
repository with:When I'm trying to pull an image (even if it doesn't exists) I get the following:
The following logs appear in the daemon:
I'm using the latest master code:
I expected to receive a login prompt from reading the code (but probably I'm missing something)
Isn't the cli supposed to prompt me for login?
/cc @aaronlehmann @tonistiigi
The text was updated successfully, but these errors were encountered: