compose: `docker-compose build --pull` on Mac fails with no basic auth credentials

Description of the issue

When installing docker and docker-compose in a virtual environment, the current versions that are installed are:

docker==3.7.2
docker-compose==1.24.0

When building a project that is pulling the FROM image from a private repo I get the following error:

Step 1/16 : FROM registry.mydomain.net/image:1.2.3
ERROR: Service 'app' failed to build: Get https://registry.mydomain.net/v2/image/manifests/1.2.3: no basic auth credentials

Context information (for bug reports)

Output of docker-compose version

[berto:env@MacBook-Pro]$ docker-compose version
docker-compose version 1.24.0, build 0aa5906
docker-py version: 3.7.2
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.0.2o  27 Mar 2018

Output of docker version

[berto:env@MacBook-Pro]$ docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:21:31 2018
 OS/Arch:           darwin/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:29:02 2018
  OS/Arch:          linux/amd64
  Experimental:     true

Output of docker-compose config (Make sure to add the relevant -f and other flags)

[berto:env@MacBook-Pro]$ docker-compose -f docker-compose.yml config
version: '3.4'
services:
  app:
    build:
      context: /Users/berto/Projects/openslate/service
    image: registry.mydomain.net/service:local

Steps to reproduce the issue

  1. pipenv shell
  2. pip install docker-compose
  3. build Dockerfile whose FROM image is private

Observed result

[berto:env@MacBook-Pro]$ docker-compose -f docker-compose.yml build --pull
WARNING: The DOCKER_IMAGE variable is not set. Defaulting to a blank string.
Building app
Step 1/16 : FROM registry.mydomain.net/image:1.2.3
ERROR: Service 'app' failed to build: Get https://registry.mydomain.net/v2/image/manifests/1.2.3: no basic auth credentials

Expected result

When configuring the virtual environment with the following, build succeeds:

pip install docker==3.6.0 docker-compose==1.23.2

Stacktrace / full error message

[berto:env@MacBook-Pro]$ DOCKER_IMAGE=test docker-compose -f docker-compose.yml build --pull
Building app
Step 1/16 : FROM registry.mydomain.net/image:1.2.3
Service 'app' failed to build: Get https://registry.mydomain.net/v2/image/manifests/1.2.3: no basic auth credentials

Additional information

  • Mac OS X 10.14.4
  • docker-compose install via pip install in a pipenv-created virtual environment

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 12
  • Comments: 19

Most upvoted comments

We are experiencing this issue with the latest version of (2.1.0.0) Build 36874

Specifically we can successfully pull via docker pull, but when a private image is used as a FROM ie: FROM <account>.dkr.ecr.<region>.amazonaws.com/<repo>/<image>:<tag> in a docker-compose build statement it fails to pull with

ERROR: Service '<service>' failed to build: Get https://<account>.dkr.ecr.<region>.amazonaws.com/v2/<repo>/manifests/<tag>: no basic auth credentials

I am logged in via docker login, as i can successfully pull with:

docker pull <account>.dkr.ecr.<region>.amazonaws.com/<repo>/<image>:<tag>

For more context, this error has existed in docker edge for months.

Funnily enough after upgrading to the most recent version of docker edge, it is not affected by this bug.

We’re experiencing this, too, using the same versions as @fonged. I’m wondering why this issue is tagged as a question… seems to be a bug. Possibly related to #6832.

My team is having to downgrade to v2.0.0.3 to work around this 😦

@ulyssessouza this is not a docker-compose problem. I’ve isolated it to a commit in docker-py. Opened an issue there with a detailed explanation of the root cause: https://github.com/docker/docker-py/issues/2402.

Also have a PR open with a candidate fix which works for me locally: https://github.com/docker/docker-py/pull/2401. Not sure if it’s the correct fix, but at least should hopefully shed light in the right area.

https://github.com/docker/docker-py/pull/2401 has been merged, so we just need a release of docker-py to get this fixed

Just found that we are experiencing this as well. My forehead is sore from banging it on my desk.

Bump! My organization has this issue as well.

Hi all, I’m experiencing the same issue. I’m not able to pull image from private repositories (AWS ECR in my case) using docker-compose but I’m able to pull same images using docker. Here I found that running sudo docker login and sudo docker-compose everything is working fine. I think running those commands using sudo isn’t acceptable so I’m looking for a different solution but this may help investigate the problem.

Thanks