docker / docker/docker-py

Building images fails on auth errors even when auth is not required

Open
#3,379 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

The Problem

When running DockerClient.images.build(...), if a StoreError is raised when running AuthConfig._resolve_authconfig_credstore (link) when trying to create auth headers for the build request, the whole command fails.

For my specific example, I have gcloud auth artifacts on my local machine that require login once per day - if I have not logged in and try to build a publicly accessible image, that build will still fail since docker-credentials-gcloud get exits non-zero by prompting me to log in again, even though that auth is not required.

Proposed Solution

Either:

  • try/except each call to _resolve_authconfig_credstore in get_all_credentials (link and link) and just don't add them to auth_data if the call errors
  • do not raise a DockerExecption from the StoreError in _resolve_authconfig_credstore and treat it the same as a CredentialsNotFound error (I could see this breaking other things)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read docker/auth.py around _resolve_authconfig_credstore and get_all_credentials, then trace how DockerClient.images.build uses the resulting auth data. Reproduce a public image build with an auth credential-store error and verify that the build no longer fails when those credentials are not required.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
authentication, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.