Compose: Compose build doesn't respect credential helpers

Created on 6 Apr 2018  ·  13Comments  ·  Source: docker/compose

When I'm running docker-compose build it's not able to pull private base images.

WHAT I EXPERIENCE
I use docker-credential-gcr and my ~/.docker/config.json is correctly set up.

  • I'm able to do docker pull myprivaterepo/myimage
  • I'm able to do docker-compose pull if the image is used as a service image
  • I'm not able to do docker-compose build as the private base image cannot be pulled.

ERROR: Service 'hello' failed to build: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

WHAT I EXPECT
Since I'm able to pull the image with docker pull, Compose should be able to pull too even in a build phase.

REPRO CASE

Dockerfile

From myprivaterepo/myimage

docker-compose.yml

version: '3.2'

services:
  hello:
    build: &build
      context: .

ENV

cat ~/.docker/config.json 
{
        "auths": {},
        "credHelpers": {
                "asia.gcr.io": "gcr",
                "eu.gcr.io": "gcr",
                "gcr.io": "gcr",
                "staging-k8s.gcr.io": "gcr",
                "us.gcr.io": "gcr"
        }
}
$ docker --version
Docker version 18.03.0-ce, build 0520e24
$ docker-compose --version
docker-compose version 1.20.1, build 5d8c71b
arebuild docker-py kinbug statu0-triage

All 13 comments

does using the CLI (docker build) to build that same image work? You mention that pull works in both cases, but I'm curious to know whether the build behavior is different or not.

Yes it works. Starts by pulling the image.

@laszlocph Was this on Windows by any chance?

Ubuntu 17.10 :(

Same issue here.

❯ uname -a                                                                                                                  
Linux 4.14.44-1-MANJARO #1 SMP PREEMPT Fri May 25 18:35:59 UTC 2018 x86_64 GNU/Linux

❯ docker -v        
Docker version 18.05.0-ce, build f150324782

❯ docker-compose -v
docker-compose version 1.21.2, build unknown

Possibly related: #5950

same here on macos

> uname -a
Darwin talentix.local 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64

> docker -v
Docker version 18.06.1-ce, build e68fc7a

> docker-compose -v
docker-compose version 1.23.1, build b02f130

and linux

> uname -a
Linux 123-test 4.18.0-11-generic #12-Ubuntu SMP Tue Oct 23 19:22:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

> docker -v
Docker version 18.06.1-ce, build e68fc7a

> docker-compose -v
docker-compose version 1.21.0, build unknown

build passes if all images are retrieved using docker pull docker-compose build

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Satisfying the stale bot with this comment. The above linked PR has promising work aiming to solve this.

This issue has been automatically marked as not stale anymore due to the recent activity.

Can't reproduce your issue with the last version of compose

> docker-compose version
docker-compose version 1.24.1, build 4667896
docker-py version: 3.7.3
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

&

> gcloud --version
Google Cloud SDK 266.0.0
bq 2.0.48
core 2019.10.04
docker-credential-gcr
gsutil 4.44

Can you give a try & let me know ?

I cannot reporoduce the issue anymore :+1:

➜  docker-compose version
docker-compose version 1.21.0, build 5920eb0
docker-py version: 3.2.1
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.0.1t  3 May 2016
➜  docker version
Client:
 Version:           18.09.6
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        481bc77156
 Built:             Sat May  4 02:35:29 2019
 OS/Arch:           linux/amd64
 Experimental:      false
➜  gcloud version
Google Cloud SDK 263.0.0

Cool 👍
So I close the issue, thanks for your feedback

Was this page helpful?
0 / 5 - 0 ratings