Skip to content
This repository was archived by the owner on Apr 7, 2024. It is now read-only.

Expose the registry name mapping methods #72

Closed
Wwwsylvia opened this issue Jun 6, 2023 · 0 comments · Fixed by #76
Closed

Expose the registry name mapping methods #72

Wwwsylvia opened this issue Jun 6, 2023 · 0 comments · Fixed by #76
Assignees
Labels
enhancement New feature or request

Comments

@Wwwsylvia
Copy link
Member

As users may still need to do the mapping from docker.io to https://index.docker.io/v1/ in their code when using Store.Get(), Store.Put() and Store.Delete(), we can consider expose the existing mapping methods for their convenience.

We may export the following methods and may rename them if needed:

  • func mapStoreRegistryName(registry string) string {
    // The Docker CLI expects that the 'docker.io' credential
    // will be added under the key "https://index.docker.io/v1/"
    // See: https://github.com/moby/moby/blob/v24.0.0-beta.2/registry/config.go#L25-L48
    if registry == "docker.io" {
    return "https://index.docker.io/v1/"
    }
    return registry
    }
  • func mapAuthenticationRegistryName(hostname string) string {
    // It is expected that the traffic targetting "registry-1.docker.io"
    // will be redirected to "https://index.docker.io/v1/"
    // See: https://github.com/moby/moby/blob/v24.0.0-beta.2/registry/config.go#L25-L48
    if hostname == "registry-1.docker.io" {
    return "https://index.docker.io/v1/"
    }
    return hostname
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants