Skip to content

[Bug]: DOCKER_AUTH_CONFIG not obeyed when using Podman #9477

@stantonk

Description

@stantonk

Module

Core

Testcontainers version

1.20.3

Using the latest Testcontainers version?

Yes

Host OS

MacOS 14.7.1 (23H222)

Host Arch

x86

Docker version

Using Podman Desktop
podman version 5.2.5

What happened?

Pulling containers from ECR fails, in spite of authentication being present in $HOME/.config/containers/auth.json and DOCKER_AUTH_CONFIG environment variable being set to $HOME/.config/containers/auth.json.

What happens:

17:13:30.642 [main] INFO  org.testcontainers.utility.RegistryAuthLocator - Failure when attempting to lookup auth config. Please ignore if you don't have images in an authenticated registry. Details: (dockerImageName: REDACTED.dkr.ecr.us-east-1.amazonaws.com/REDACTED:latest, configFile: /Users/kevin/.docker/config.json, configEnv: DOCKER_AUTH_CONFIG). Falling back to docker-java default behaviour. Exception message: Status 404: No config supplied. Checked in order: /Users/kevin/.docker/config.json (file not found), DOCKER_AUTH_CONFIG (not set)

The problem from looking at the code is that this code path is never exercised in RegistryAuthLocatorTest (confirmed by running code coverage on the test).

DOCKER_AUTH_ENV_VAR is only used in the protected constructor of RegistryAuthLocator, which is only used in the RegistryAuthLocator.instance() static method.

So it ends up trying to deserialize the path value of the environment variable, instead of deserializing the contents of the file at the path in DOCKER_AUTH_CONFIG envvar.

Relevant log output

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions