From d768343cbe275f34be77d71a2c7c22da256d63dd Mon Sep 17 00:00:00 2001 From: Daniel Menet Date: Sat, 9 Aug 2014 09:16:54 +0200 Subject: [PATCH 1/2] Enable `docker search` on private docker registry. The cli interface works similar to other registry related commands: docker search foo ... searches for foo on the official hub docker search localhost:5000/foo ... does the same for the private reg at localhost:5000 Signed-off-by: Daniel Menet --- docs/service.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/service.go b/docs/service.go index d2775e3c..8c2c0cc7 100644 --- a/docs/service.go +++ b/docs/service.go @@ -82,7 +82,11 @@ func (s *Service) Search(job *engine.Job) engine.Status { job.GetenvJson("authConfig", authConfig) job.GetenvJson("metaHeaders", metaHeaders) - r, err := NewRegistry(authConfig, HTTPRequestFactory(metaHeaders), IndexServerAddress(), true) + hostname, term, err := ResolveRepositoryName(term) + if err != nil { + return job.Error(err) + } + r, err := NewRegistry(authConfig, HTTPRequestFactory(metaHeaders), hostname, true) if err != nil { return job.Error(err) } From 94c52da6c0934c6b8e0423c2764ac9cd26edda40 Mon Sep 17 00:00:00 2001 From: Daniel Menet Date: Sun, 10 Aug 2014 11:48:34 +0200 Subject: [PATCH 2/2] Expand hostname before passing it to NewRegistry() Signed-off-by: Daniel Menet --- docs/service.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/service.go b/docs/service.go index 8c2c0cc7..96fc3f48 100644 --- a/docs/service.go +++ b/docs/service.go @@ -86,6 +86,10 @@ func (s *Service) Search(job *engine.Job) engine.Status { if err != nil { return job.Error(err) } + hostname, err = ExpandAndVerifyRegistryUrl(hostname) + if err != nil { + return job.Error(err) + } r, err := NewRegistry(authConfig, HTTPRequestFactory(metaHeaders), hostname, true) if err != nil { return job.Error(err)