From 79661b8a7e7b075d9b56c2bced927e996f07d8f0 Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Fri, 19 Jun 2015 10:12:52 -0700 Subject: [PATCH] Unconditionally add AuthTransport. Today, endpoints implementing v2 cannot properly fallback to v1 because the underlying transport that deals with authentication (Basic / Token) doesn't get annotated. This doesn't affect DockerHub because the DockerHub endpoint appears as 'https://index.docker.io/v1/' (in .dockercfg), and the 'v1' tricks this logic just long enough that the transport is always annotated for DockerHub accesses. Signed-off-by: Matt Moore --- docs/session.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/session.go b/docs/session.go index 573a03bf8..77f6d20b3 100644 --- a/docs/session.go +++ b/docs/session.go @@ -158,9 +158,9 @@ func NewSession(client *http.Client, authConfig *cliconfig.AuthConfig, endpoint } } - if endpoint.Version == APIVersion1 { - client.Transport = AuthTransport(client.Transport, authConfig, alwaysSetBasicAuth) - } + // Annotate the transport unconditionally so that v2 can + // properly fallback on v1 when an image is not found. + client.Transport = AuthTransport(client.Transport, authConfig, alwaysSetBasicAuth) jar, err := cookiejar.New(nil) if err != nil {