docker-archive / docker-registry

This is **DEPRECATED**! Please go to https://github.com/docker/distribution
Apache License 2.0
2.88k stars 879 forks source link

docker search not working with private registry #955

Closed clintharris closed 8 years ago

clintharris commented 9 years ago

I’ve set up a private registry by doing a ‘docker pull’ of registry:latest and am running it behind Apache using the reference conf file.

The core features work fine. I am able to login and push/pull images.

docker search fails, however:

$ docker search myhost.com/<term>
FATA[0001] Error response from daemon: Unexpected status code 401 

The Apache error log seems to suggest that the basic auth user isn’t being passed for some reason:

[Fri Mar 06 21:48:39.836110 2015] [auth_basic:error] [pid 4933:tid 140499293751040] [client xxx.xxx.xxx.xxx:62602] AH01618: user  not found: /v1/search

I believe the issue must be with the Docker client. I am able to successfully curl the search URL directly with basic http auth:

$ curl -u myuser https://myhost.com/v1/search
Enter host password for user 'myuser':
{"num_results": 2, "query": "", "results": [{"description": null, "name": “foo/bar”}, {"description": null, "name": "library/busybox_test"}]}

Just for additional info, here’s what I see in the Gunicorn logging output (i.e., by doing a docker logs on the server); clearly no error at the registry container level:

172.17.42.1 - - [06/Mar/2015:21:48:38 +0000] "GET /v1/_ping HTTP/1.1" 200 1586 "-" "Go 1.1 package http"
172.17.42.1 - - [06/Mar/2015:21:48:39 +0000] "GET /v1/_ping HTTP/1.1" 200 1586 "-" "Go 1.1 package http"

Can someone verify that this is a bug or offer some thoughts on what I may be doing wrong? Thanks!

Client:

Registry/server:

dmp42 commented 9 years ago

If you disable authentication for the search endpoint, does it work? I'm pretty sure this is an engine bug with regard to auth. with search.

clintharris commented 9 years ago

@dmp42 Yes, it works if I disable authentication for /v1/search endpoint. Not a great work-around if you're terribly security conscious...

What do you mean by "engine bug"?

dmp42 commented 9 years ago

"Docker bug". https://github.com/docker/docker/pull/10050

calavera commented 8 years ago

It looks like this was fixed with #10050. can we close it?

Nevermind, just realized that this is the deprecated repo, sorry for the noise.

dmp42 commented 8 years ago

@calavera np - closing either way :)