docker: Index | Files | Directories

package distribution

import ""


Package Files

config.go errors.go manifest.go pull.go pull_v2.go pull_v2_unix.go push.go push_v2.go registry.go


var ImageTypes = []string{



ImageTypes represents the schema2 config types for images

var PluginTypes = []string{

PluginTypes represents the schema2 config types for plugins

func NewLayerProvidersFromStores Uses

func NewLayerProvidersFromStores(lss map[string]layer.Store) map[string]PushLayerProvider

NewLayerProvidersFromStores returns layer providers backed by an instance of LayerStore. Only getting layers as gzipped tars is supported.

func NewV2Repository Uses

func NewV2Repository(
    ctx context.Context, repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint,
    metaHeaders http.Header, authConfig *types.AuthConfig, actions ...string,
) (repo distribution.Repository, foundVersion bool, err error)

NewV2Repository returns a repository (v2 only). It creates an HTTP transport providing timeout settings and authentication support, and also verifies the remote API version.

func Pull Uses

func Pull(ctx context.Context, ref reference.Named, imagePullConfig *ImagePullConfig, local ContentStore) error

Pull initiates a pull operation. image is the repository name to pull, and tag may be either empty, or indicate a specific tag to pull.

func Push Uses

func Push(ctx context.Context, ref reference.Named, imagePushConfig *ImagePushConfig) error

Push initiates a push operation on ref. ref is the specific variant of the image to be pushed. If no tag is provided, all tags will be pushed.

func TranslatePullError Uses

func TranslatePullError(err error, ref reference.Named) error

TranslatePullError is used to convert an error from a registry pull operation to an error representing the entire pull operation. Any error information which is not used by the returned error gets output to log at info level.

func ValidateRepoName Uses

func ValidateRepoName(name reference.Named) error

ValidateRepoName validates the name of a repository.

type Config Uses

type Config struct {
    // MetaHeaders stores HTTP headers with metadata about the image
    MetaHeaders map[string][]string
    // AuthConfig holds authentication credentials for authenticating with
    // the registry.
    AuthConfig *types.AuthConfig
    // ProgressOutput is the interface for showing the status of the pull
    // operation.
    ProgressOutput progress.Output
    // RegistryService is the registry service to use for TLS configuration
    // and endpoint lookup.
    RegistryService registry.Service
    // ImageEventLogger notifies events for a given image
    ImageEventLogger func(id, name, action string)
    // MetadataStore is the storage backend for distribution-specific
    // metadata.
    MetadataStore metadata.Store
    // ImageStore manages images.
    ImageStore ImageConfigStore
    // ReferenceStore manages tags. This value is optional, when excluded
    // content will not be tagged.
    ReferenceStore refstore.Store
    // RequireSchema2 ensures that only schema2 manifests are used.
    RequireSchema2 bool

Config stores configuration for communicating with a registry.

type ContentStore Uses

type ContentStore interface {
    Info(ctx context.Context, dgst digest.Digest) (content.Info, error)
    Abort(ctx context.Context, ref string) error

ContentStore is the interface used to persist registry blobs

Currently this is only used to persist manifests and manifest lists. It is exported because `distribution.Pull` takes one as an argument.

type ErrNoSupport Uses

type ErrNoSupport struct{ Err error }

ErrNoSupport is an error type used for errors indicating that an operation is not supported. It encapsulates a more specific error.

func (ErrNoSupport) Error Uses

func (e ErrNoSupport) Error() string

type ImageConfigPullError Uses

type ImageConfigPullError struct {
    Err error

ImageConfigPullError is an error pulling the image config blob (only applies to schema2).

func (ImageConfigPullError) Error Uses

func (e ImageConfigPullError) Error() string

Error returns the error string for ImageConfigPullError.

type ImageConfigStore Uses

type ImageConfigStore interface {
    Put(context.Context, []byte) (digest.Digest, error)
    Get(context.Context, digest.Digest) ([]byte, error)
    RootFSFromConfig([]byte) (*image.RootFS, error)
    PlatformFromConfig([]byte) (*specs.Platform, error)

ImageConfigStore handles storing and getting image configurations by digest. Allows getting an image configurations rootfs from the configuration.

func NewImageConfigStoreFromStore Uses

func NewImageConfigStoreFromStore(is image.Store) ImageConfigStore

NewImageConfigStoreFromStore returns an ImageConfigStore backed by an image.Store for container images.

type ImagePullConfig Uses

type ImagePullConfig struct {

    // DownloadManager manages concurrent pulls.
    DownloadManager RootFSDownloadManager
    // Schema2Types is the valid schema2 configuration types allowed
    // by the pull operation.
    Schema2Types []string
    // Platform is the requested platform of the image being pulled
    Platform *specs.Platform

ImagePullConfig stores pull configuration.

type ImagePushConfig Uses

type ImagePushConfig struct {

    // ConfigMediaType is the configuration media type for
    // schema2 manifests.
    ConfigMediaType string
    // LayerStores (indexed by operating system) manages layers.
    LayerStores map[string]PushLayerProvider
    // TrustKey is the private key for legacy signatures. This is typically
    // an ephemeral key, since these signatures are no longer verified.
    TrustKey libtrust.PrivateKey
    // UploadManager dispatches uploads.
    UploadManager *xfer.LayerUploadManager

ImagePushConfig stores push configuration.

type Puller Uses

type Puller interface {
    // Pull tries to pull the image referenced by `tag`
    // Pull returns an error if any, as well as a boolean that determines whether to retry Pull on the next configured endpoint.
    Pull(ctx context.Context, ref reference.Named, platform *specs.Platform) error

Puller is an interface that abstracts pulling for different API versions.

type PushLayer Uses

type PushLayer interface {
    ChainID() layer.ChainID
    DiffID() layer.DiffID
    Parent() PushLayer
    Open() (io.ReadCloser, error)
    Size() (int64, error)
    MediaType() string

PushLayer is a pushable layer with metadata about the layer and access to the content of the layer.

type PushLayerProvider Uses

type PushLayerProvider interface {
    Get(layer.ChainID) (PushLayer, error)

PushLayerProvider provides layers to be pushed by ChainID.

type Pusher Uses

type Pusher interface {
    // Push tries to push the image configured at the creation of Pusher.
    // Push returns an error if any, as well as a boolean that determines whether to retry Push on the next configured endpoint.
    // TODO(tiborvass): have Push() take a reference to repository + tag, so that the pusher itself is repository-agnostic.
    Push(ctx context.Context) error

Pusher is an interface that abstracts pushing for different API versions.

func NewPusher Uses

func NewPusher(ref reference.Named, endpoint registry.APIEndpoint, repoInfo *registry.RepositoryInfo, imagePushConfig *ImagePushConfig) (Pusher, error)

NewPusher creates a new Pusher interface that will push to either a v1 or v2 registry. The endpoint argument contains a Version field that determines whether a v1 or v2 pusher will be created. The other parameters are passed through to the underlying pusher implementation for use during the actual push operation.

type RootFSDownloadManager Uses

type RootFSDownloadManager interface {
    // Download downloads the layers into the given initial rootfs and
    // returns the final rootfs.
    // Given progress output to track download progress
    // Returns function to release download resources
    Download(ctx context.Context, initialRootFS image.RootFS, os string, layers []xfer.DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error)

RootFSDownloadManager handles downloading of the rootfs



Package distribution imports 53 packages (graph) and is imported by 794 packages. Updated 2020-12-17. Refresh now. Tools for package owners.