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

Docker client does not handle HTTP 401 responses properly #11016

Closed
ghost opened this issue Feb 25, 2015 · 3 comments
Closed

Docker client does not handle HTTP 401 responses properly #11016

ghost opened this issue Feb 25, 2015 · 3 comments
Labels
exp/beginner kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Comments

@ghost
Copy link

ghost commented Feb 25, 2015

Context

I am running a private Docker registry (h3nrik/simple-registry). On top an nginx authentication proxy is running (h3nrik/registry-ldap-auth). That proxy enforces the username to match the image namespace when creating or deleting tags. That works so far without any problems.

Problem description

When I now use the Docker client to push an image with a namespace that does not match the username the proxy returns an HTTP 401 response. But the client does not show any error message it just ends unexpectedly with a return code 1:

$ docker push registry.local/invaliduser/myimage:latest
The push refers to a repository [registry.local/invaliduser/myimage] (len: 1)
Sending image list
$ echo $?
1

Expectation

I would expect the client to display a proper error message because the Docker Registry API specification explicitly lists a possible HTTP 401 error for those two requests (and also for others but these are the only ones that I have tested so far):

DELETE /v1/repositories/(namespace)/(repository)/tags/(tag*)
PUT /v1/repositories/(namespace)/(repository)/tags/(tag*)

Environment

$ docker info
Containers: 1
Images: 16
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 18
Execution Driver: native-0.2
Kernel Version: 3.18.5-tinycore64
Operating System: Boot2Docker 1.5.0 (TCL 5.4); master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015
Debug mode (server): true
Debug mode (client): false
Fds: 19
Goroutines: 21
EventsListeners: 0
Init Path: /usr/local/bin/docker
@jessfraz jessfraz added kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. white-belt labels Feb 26, 2015
@spf13 spf13 added exp/beginner /dist/registry kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. and removed /dist/registry kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. labels Mar 21, 2015
@duglin
Copy link
Contributor

duglin commented Apr 13, 2015

@G17 is this still an issue? When I tried it I do see a nice error message now but I may be doing it slightly differently than you

@ghost
Copy link
Author

ghost commented May 4, 2015

@duglin It seems to be fixed with 1.6.0. Now I get a proper error message:

 Sending image list
 FATA[0003] Authentication is required.

@duglin
Copy link
Contributor

duglin commented May 4, 2015

cool - thanks for checking. Will close this issue.

@duglin duglin closed this as completed May 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/beginner kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Projects
None yet
Development

No branches or pull requests

3 participants