Documentation
¶
Overview ¶
Package registry talks to OCI registries: resolving references, pulling manifests and layers, and exporting an unpacked root filesystem.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
Username string
Password string
PasswordFile string
// CredentialHelper names a docker-credential-<name> program on the
// daemon's PATH, which gives the credentials each time they are needed.
CredentialHelper string
}
Auth is how to log in to one registry: with a username and a password, given or read from a file, or through a credential helper.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client resolves image references against their registries, and pulls images through a layer cache: an OCI layout on disk, in which each image is named by its manifest digest's hex. It is safe for concurrent use.
func (*Client) PruneCache ¶
PruneCache drops every image from the layer cache but those keep names, by their manifest digests' hex, with the blobs no image left uses, and returns the bytes reclaimed.
func (*Client) PullAndExport ¶
func (c *Client) PullAndExport( ctx context.Context, imageRef, digest, exportDir string, onProgress ProgressFunc, ) (*Metadata, error)
PullAndExport pulls the image with the manifest digest from imageRef's repository into the layer cache, unless it is there already, and unpacks its root filesystem into exportDir. It reports progress to onProgress, which may be nil, and returns the image's metadata.
type CredentialsError ¶
CredentialsError reports that the credentials configured for a registry could not be had: a password file that cannot be read, or a credential helper that fails.
func (*CredentialsError) Unwrap ¶
func (e *CredentialsError) Unwrap() error
Unwrap returns the cause.
type Keychain ¶ added in v0.4.0
type Keychain struct {
// contains filtered or unexported fields
}
Keychain gives each registry the credentials configured for it, by host, and every other registry none: an image there is pulled anonymously. The zero Keychain pulls every image anonymously. It implements authn.Keychain.
func NewKeychain ¶
NewKeychain returns a keychain of the credentials in auths, keyed by registry host. Docker Hub may be named docker.io.
type Metadata ¶
type Metadata struct {
Entrypoint []string
Cmd []string
Env map[string]string
WorkingDir string
// User is the image's USER: user, uid, user:group or uid:gid. Empty is
// root.
User string
// HealthCheck is the image's HEALTHCHECK as Docker records it, or nil.
HealthCheck *gcr.HealthConfig
}
Metadata is the part of an image's configuration an instance runs with.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithKeychain ¶
WithKeychain sets the credentials registries are logged in to with. Without it, every image is pulled anonymously.
type Progress ¶ added in v0.4.0
Progress reports how far a pull has got. Downloaded and Total are bytes of compressed layers, and are zero outside PhaseDownloading.
type ProgressFunc ¶ added in v0.4.0
type ProgressFunc func(Progress)
ProgressFunc receives a pull's progress. It may be nil, and is called from the goroutine doing the pull, so it should not block for long.