Skip to content

[Bug]: dockerConfigFile property file not used #10362

Open

Description

@selliera

Module

Core

Testcontainers version

1.19.8

Using the latest Testcontainers version?

Yes

Host OS

Windows

Host Arch

x86

Docker version

podman

What happened?

When trying to configure authentication, it seems that the documentation is misleading:

It says:

Use DOCKER_CONFIG_FILE environment variable.
export DOCKER_CONFIG_FILE=/some/location/config.json
Use dockerConfigFile java property
java -DdockerConfigFile=/some/location/config.json

here: https://java.testcontainers.org/modules/docker_compose/#using-private-repositories-in-docker-compose

But: dockerConfigFile is not used.
and it looks like you should not use DOCKER_CONFIG_FILE, but DOCKER_AUTH_CONFIG instead.

Not having the ability to use a system property is annoyng, since it makes it diffucult to configure docker authentication with java code directly.

That's what I infer from: https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/utility/RegistryAuthLocator.java and from my tests.

Relevant log output

Additional Information

No response

Activity

  1. selliera commented on Jun 14, 2025

    @selliera
    Author

    My bad: I confused doc for docker compose and base docker:
    What is stated here
    https://java.testcontainers.org/supported_docker_environment/#docker-registry-authentication
    Is exactly what is implemented in the RegistryAyuthLocator.

    It is surprising that dockercompose uses another configuration env var name, but there may be a good reason for that.

    Would it be possible to add a dockerConfigFile property here, to match the docker compose code ? That would help a lot integrating testcontainers with wrapper java libraries. With recent java, it is no longer possible to modify environment variable from within a process (it never was a good idea anyway). Being able to update a java system property instead would allow wrapper libraries to easily setup authentication.

    Would it be ok for me to propose a PR about that ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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