Skip to content

docker build handles credentials differently than docker pull #3716

@pbecotte

Description

@pbecotte

If a credHelper is defined, 'docker build' with a private FROM image fails, while docker pull of the same image works correctly.

Steps to reproduce the issue:

  1. 'docker login' to your private repository (we are using artifactory)
  2. Add a credHelper to config.json - for this I went with '{"credHelpers": {"blah.com": "false"}}'
  3. Make a dockerfile with a FROM for a non-existant tag in a private image of your private repo
  4. docker build - you will get the error "the client does not have permission for the manifest"
  5. docker pull - you will get the error "The named manifest is not known to the registry"
  6. Remove the credHelper - now docker build will get "The named manifest is not known to the registry"

Describe the results you expected:
'docker build' to be able to pull images the same as 'docker pull'

Additional information you deem important (e.g. issue happens only occasionally):
From our nginx logs, we can see that when the daemon requests a token it makes a request like '/v2/token?account=username' when running 'docker pull', but '/v2/token?scope=repository...' when running 'docker build'. I do not have access to the daemon logs, but the token request on 'docker build' appears to be completely unauthenticated. Removing the credHelper (whether it works or doesn't seems to be immaterial) changes the behavior- in that case, the daemon submits a correctly authenticated request for a token.

Output of docker version:

Client-
Version: 20.10.2
API: 1.39
OS: linux/amd64

Server:
Version: 20.10.2
API: 1.41

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions