Documentation
¶
Overview ¶
Package registry resolves image references against container registries. It must not import internal/store: the store imports it.
Index ¶
Constants ¶
const DockerHub = "docker.io"
DockerHub is the canonical host for references that name none.
Variables ¶
var ( ErrNotFound = errors.New("image not found in registry") ErrRateLimited = errors.New("registry rate limit reached") ErrRedirected = errors.New("registry redirects to another host") // a manifest 3xx, never followed ErrDigestMismatch = errors.New("registry digest does not match the manifest") )
var ErrInvalidReference = errors.New("invalid image reference")
var ErrPrivateDestination = errors.New("registry resolves to a private or reserved address")
Functions ¶
func CanonicalHost ¶
CanonicalHost lowercases a registry host and folds Docker Hub's aliases into docker.io, so a reference and a configured registry name the same host the same way.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CheckHost ¶
CheckHost applies Head's destination guard to ref's registry host with no registry request: what a digest reference, which needs no Head, still owes.
func (*Client) Head ¶
Head reads the digest ref names from Docker-Content-Digest without the body, so Docker Hub does not count a pull. Platforms are nil; the same request budget and guard apply.
type Credential ¶
type Credential struct {
Username, Secret string
}
Credential authenticates to one registry. Secret is held only for the call.
type Options ¶
type Options struct {
AllowPrivate bool
Timeout time.Duration // per request; 15s when zero
RootCAs *x509.CertPool
DialAddr func(ctx context.Context, host string) (netip.Addr, error)
}
Options configures a Client. RootCAs and DialAddr exist for tests only: production uses the system roots and DNS.
type Reference ¶
type Reference struct {
Host, Repository, Tag, Digest string
}
Reference is an image reference split into what a registry request needs.
func ParseReference ¶
ParseReference applies Docker's defaults: no host is docker.io, a one-component Docker Hub repository is under library/, and a reference with neither tag nor digest means latest.