Skip to content

[Enhancement]: Handling path segments in Docker registry URLs (registry authentication) #1428

Open
@HofmeisterAn

Description

@HofmeisterAn

Problem

The Azure DevOps pipeline task Docker@2 (with command: 'login') stores Docker Registry credentials in Base64 format in the config.json file. The pipeline task uses the exact Docker Registry value from the Azure DevOps service connection as the key. For example, for the Docker Registry value https://registry.example.com/harbor, the JSON entry will look like this:

{"auths":{"https://registry.example.com/harbor":{"auth":"...","email":""}},"HttpHeaders":{"X-Meta-Source-Client":"VSTS"}}

The Base64Provider implementation does not expect a path segment (like /harbor). It only expects the Docker Registry hostname.

As a result, Testcontainers is unable to find matching credentials to authenticate against the Docker Registry. Currently, valid keys are:

  • registry.example.com
  • https://registry.example.com
  • http://registry.example.com
  • xyz://registry.example.com

However, the Docker CLI does not seem to enforce this strictly and is still able to pull images with the above configuration.

As a workaround, users can modify the Docker Registry service connection value to https://registry.example.com (removing the path segment).

Should .NET relax the strict hostname check to match Docker CLI behavior?

How do your implementations behave @kiview @eddumelendez @mdelapenya @cristianrgreco?

Solution

-

Benefit

Align behavior with the Docker CLI and support more configurations OOB.

Alternatives

-

Would you like to help contributing this enhancement?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions