registry

package
v5.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultNamespace is the default namespace
	DefaultNamespace = "docker.io"
	// DefaultRegistryHost is the hostname for the default (Docker Hub) registry
	// used for pushing and pulling images. This hostname is hard-coded to handle
	// the conversion from image references without registry name (e.g. "ubuntu",
	// or "ubuntu:latest"), as well as references using the "docker.io" domain
	// name, which is used as canonical reference for images on Docker Hub, but
	// does not match the domain-name of Docker Hub's registry.
	DefaultRegistryHost = "registry-1.docker.io"
	// IndexHostname is the index hostname, used for authentication and image search.
	IndexHostname = "index.docker.io"
	// IndexServer is used for user auth and image search
	IndexServer = "https://" + IndexHostname + "/v1/"
	// IndexName is the name of the index
	IndexName = "docker.io"
	// StagingRegistryHost is the Docker Hub staging registry.
	StagingRegistryHost = "registry-1-stage.docker.io"
	// StagingIndexServer is the credentials key for StagingRegistryHost.
	StagingIndexServer = "https://" + StagingRegistryHost + "/"
	// DHIRegistryHost is the Docker Hardened Images registry.
	DHIRegistryHost = "dhi.io"
	// DHIIndexServer is the credentials key for DHIRegistryHost.
	DHIIndexServer = "https://" + DHIRegistryHost
)

Variables

This section is empty.

Functions

func EncodedAuth added in v5.5.1

func EncodedAuth(ref reference.Named, cfg AuthProvider) (string, error)

EncodedAuth returns the credentials for the registry hosting the given image reference, base64-encoded as expected by the Docker API's X-Registry-Auth header. The configfile normalizes the Docker Hub domain to its canonical credentials key itself.

func GetAuthConfigKey

func GetAuthConfigKey(indexName string) string

GetAuthConfigKey special-cases using the full index address of the official index as the AuthConfig key, and uses the (host)name[:port] for private indexes.

It differs from the docker CLI configfile's own normalization by also mapping the registry host (registry-1.docker.io): OCI resolvers hand the credential callback the network host actually contacted, not the reference domain.

func ImageDigestResolver added in v5.7.2

func ImageDigestResolver(ctx context.Context, auth AuthProvider, c client.APIClient) func(named reference.Named) (digest.Digest, error)

ImageDigestResolver returns a func resolving an image reference to the descriptor digest its registry holds for it, with the credentials of auth. The lookup is made through DistributionInspect with ctx. It serves pinning image references in a reproducible compose model (`compose publish` / `config --resolve-image-digests`).

It deliberately returns the registry descriptor digest — the multi-platform index digest for multi-arch images: a published compose file must stay deployable on any platform. This is NOT the same digest kind as the local content digest, which selects the platform-specific runnable manifest to compare a running container with a fresh build/pull; never funnel this resolution through the local content-digest producer, and never pin a published reference with a per-platform digest.

Types

type AuthProvider added in v5.5.1

type AuthProvider interface {
	GetAuthConfig(registryHostname string) (clitypes.AuthConfig, error)
}

AuthProvider provides registry credentials for a registry hostname, as implemented by the docker CLI's configfile.

func NewDesktopAuthProvider added in v5.7.0

func NewDesktopAuthProvider(fallback AuthProvider) AuthProvider

NewDesktopAuthProvider returns an AuthProvider that uses the Docker Desktop session for Docker Hub, and fallback otherwise.

type AuthProviderFunc added in v5.7.0

type AuthProviderFunc func(registryHostname string) (clitypes.AuthConfig, error)

AuthProviderFunc adapts a function to AuthProvider.

func (AuthProviderFunc) GetAuthConfig added in v5.7.0

func (f AuthProviderFunc) GetAuthConfig(registryHostname string) (clitypes.AuthConfig, error)

GetAuthConfig calls f.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL