From 0ca49c066c07d5425227c0a4199e30b5e4a0e5c7 Mon Sep 17 00:00:00 2001 From: Nick Ethier Date: Tue, 8 May 2018 15:06:11 -0400 Subject: [PATCH] client/driver: use correct repo address when using docker-credential helper --- CHANGELOG.md | 5 ++++- client/driver/docker.go | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16e5a54d42dd..8fbfd4034113 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,10 @@ IMPROVEMENTS: jobspec [[GH-4239](https://github.com/hashicorp/nomad/issues/4239)] * discovery: Support Consul gRPC health checks. [[GH-4251](https://github.com/hashicorp/nomad/issues/4251)] * driver/docker: Add progress monitoring and inactivity detection to docker - image pulls [[GH-4192](https://github.com/hashicorp/nomad/issues/4192)] + image pulls [[GH-4192](https://github.com/hashicorp/nomad/issues/4192)] + +BUG FIXES: + * driver/docker: Fix docker credential helper support [[GH-3818](https://github.com/hashicorp/nomad/issues/3818)] [[GH-4221](https://github.com/hashicorp/nomad/issues/4221)] ## 0.8.3 (April 27, 2018) diff --git a/client/driver/docker.go b/client/driver/docker.go index cc31e547eae3..d6a326017289 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -2130,13 +2130,15 @@ func authFromHelper(helperName string) authBackend { helper := dockerAuthHelperPrefix + helperName cmd := exec.Command(helper, "get") - // Ensure that the HTTPs prefix exists - if !strings.HasPrefix(repo, "https://") { - repo = fmt.Sprintf("https://%s", repo) + repoInfo, err := parseRepositoryInfo(repo) + if err != nil { + return nil, err } - cmd.Stdin = strings.NewReader(repo) + // Ensure that the HTTPs prefix exists + repoAddr := fmt.Sprintf("https://%s", repoInfo.Hostname()) + cmd.Stdin = strings.NewReader(repoAddr) output, err := cmd.Output() if err != nil { switch err.(type) {