containerd

package
v0.0.0-...-60a7b14 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageService

type ImageService struct {
	// contains filtered or unexported fields
}

ImageService implements daemon.ImageService

func NewService

func NewService(c *containerd.Client, snapshotter string) *ImageService

NewService creates a new ImageService.

func (*ImageService) Children

func (i *ImageService) Children(id image.ID) []image.ID

Children returns the children image.IDs for a parent image. called from list.go to filter containers TODO: refactor to expose an ancestry for image.ID?

func (*ImageService) Cleanup

func (i *ImageService) Cleanup() error

Cleanup resources before the process is shutdown. called from daemon.go Daemon.Shutdown()

func (*ImageService) CommitBuildStep

func (i *ImageService) CommitBuildStep(c backend.CommitConfig) (image.ID, error)

CommitBuildStep is used by the builder to create an image for each step in the build.

This method is different from CreateImageFromContainer:

  • it doesn't attempt to validate container state
  • it doesn't send a commit action to metrics
  • it doesn't log a container commit event

This is a temporary shim. Should be removed when builder stops using commit.

func (*ImageService) CommitImage

func (i *ImageService) CommitImage(c backend.CommitConfig) (image.ID, error)

CommitImage creates a new image from a commit config.

func (*ImageService) CountImages

func (i *ImageService) CountImages() int

CountImages returns the number of images stored by ImageService called from info.go

func (*ImageService) CreateImage

func (i *ImageService) CreateImage(config []byte, parent string) (builder.Image, error)

CreateImage creates a new image by adding a config and ID to the image store. This is similar to LoadImage() except that it receives JSON encoded bytes of an image instead of a tar archive.

func (*ImageService) CreateLayer

func (i *ImageService) CreateLayer(container *container.Container, initFunc layer.MountInit) (layer.RWLayer, error)

CreateLayer creates a filesystem layer for a container. called from create.go TODO: accept an opt struct instead of container?

func (*ImageService) DistributionServices

func (i *ImageService) DistributionServices() images.DistributionServices

DistributionServices return services controlling daemon image storage.

func (*ImageService) ExportImage

func (i *ImageService) ExportImage(ctx context.Context, names []string, outStream io.Writer) error

ExportImage exports a list of images to the given output stream. The exported images are archived into a tar when written to the output stream. All images with the given tag and all versions containing the same tag are exported. names is the set of tags to export, and outStream is the writer which the images are written to.

TODO(thaJeztah): produce JSON stream progress response and image events; see https://github.com/moby/moby/issues/43910

func (*ImageService) GetContainerLayerSize

func (i *ImageService) GetContainerLayerSize(containerID string) (int64, int64)

GetContainerLayerSize returns the real size & virtual size of the container.

func (*ImageService) GetImage

func (i *ImageService) GetImage(ctx context.Context, refOrID string, options imagetype.GetImageOpts) (retImg *image.Image, retErr error)

GetImage returns an image corresponding to the image referred to by refOrID.

func (*ImageService) GetImageAndReleasableLayer

func (i *ImageService) GetImageAndReleasableLayer(ctx context.Context, refOrID string, opts backend.GetImageAndLayerOptions) (builder.Image, builder.ROLayer, error)

GetImageAndReleasableLayer returns an image and releaseable layer for a reference or ID. Every call to GetImageAndReleasableLayer MUST call releasableLayer.Release() to prevent leaking of layers.

func (*ImageService) GetLayerByID

func (i *ImageService) GetLayerByID(cid string) (layer.RWLayer, error)

GetLayerByID returns a layer by ID called from daemon.go Daemon.restore(), and Daemon.containerExport().

func (*ImageService) GetLayerFolders

func (i *ImageService) GetLayerFolders(img *image.Image, rwLayer layer.RWLayer) ([]string, error)

GetLayerFolders returns the layer folders from an image RootFS.

func (*ImageService) GetLayerMountID

func (i *ImageService) GetLayerMountID(cid string) (string, error)

GetLayerMountID returns the mount ID for a layer called from daemon.go Daemon.Shutdown(), and Daemon.Cleanup() (cleanup is actually continerCleanup) TODO: needs to be refactored to Unmount (see callers), or removed and replaced with GetLayerByID

func (*ImageService) GetRepository

func (i *ImageService) GetRepository(ctx context.Context, ref reference.Named, authConfig *registry.AuthConfig) (distribution.Repository, error)

GetRepository returns a repository from the registry.

func (*ImageService) ImageDelete

func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)

ImageDelete deletes the image referenced by the given imageRef from this daemon. The given imageRef can be an image ID, ID prefix, or a repository reference (with an optional tag or digest, defaulting to the tag name "latest"). There is differing behavior depending on whether the given imageRef is a repository reference or not.

If the given imageRef is a repository reference then that repository reference will be removed. However, if there exists any containers which were created using the same image reference then the repository reference cannot be removed unless either there are other repository references to the same image or force is true. Following removal of the repository reference, the referenced image itself will attempt to be deleted as described below but quietly, meaning any image delete conflicts will cause the image to not be deleted and the conflict will not be reported.

There may be conflicts preventing deletion of an image and these conflicts are divided into two categories grouped by their severity:

Hard Conflict:

  • a pull or build using the image.
  • any descendant image.
  • any running container using the image.

Soft Conflict:

  • any stopped container using the image.
  • any repository tag or digest references to the image.

The image cannot be removed if there are any hard conflicts and can be removed if there are soft conflicts only if force is true.

If prune is true, ancestor images will each attempt to be deleted quietly, meaning any delete conflicts will cause the image to not be deleted and the conflict will not be reported.

TODO(thaJeztah): implement ImageDelete "force" options; see https://github.com/moby/moby/issues/43850 TODO(thaJeztah): implement ImageDelete "prune" options; see https://github.com/moby/moby/issues/43849 TODO(thaJeztah): add support for image delete using image (short)ID; see https://github.com/moby/moby/issues/43854 TODO(thaJeztah): mage delete should send image "untag" events and prometheus counters; see https://github.com/moby/moby/issues/43855

func (*ImageService) ImageDiskUsage

func (i *ImageService) ImageDiskUsage(ctx context.Context) ([]*types.ImageSummary, error)

ImageDiskUsage returns information about image data disk usage.

func (*ImageService) ImageHistory

func (i *ImageService) ImageHistory(name string) ([]*imagetype.HistoryResponseItem, error)

ImageHistory returns a slice of ImageHistory structures for the specified image name by walking the image lineage.

func (*ImageService) Images

Images returns a filtered list of images.

TODO(thaJeztah): sort the results by created (descending); see https://github.com/moby/moby/issues/43848 TODO(thaJeztah): implement opts.ContainerCount (used for docker system df); see https://github.com/moby/moby/issues/43853 TODO(thaJeztah): add labels to results; see https://github.com/moby/moby/issues/43852 TODO(thaJeztah): verify behavior of `RepoDigests` and `RepoTags` for images without (untagged) or multiple tags; see https://github.com/moby/moby/issues/43861 TODO(thaJeztah): verify "Size" vs "VirtualSize" in images; see https://github.com/moby/moby/issues/43862

func (*ImageService) ImagesPrune

func (i *ImageService) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)

ImagesPrune removes unused images

func (*ImageService) ImportImage

func (i *ImageService) ImportImage(ctx context.Context, src string, repository string, platform *specs.Platform, tag string, msg string, inConfig io.ReadCloser, outStream io.Writer, changes []string) error

ImportImage imports an image, getting the archived layer data either from inConfig (if src is "-"), or from a URI specified in src. Progress output is written to outStream. Repository and tag names can optionally be given in the repo and tag arguments, respectively.

func (*ImageService) LayerDiskUsage

func (i *ImageService) LayerDiskUsage(ctx context.Context) (int64, error)

LayerDiskUsage returns the number of bytes used by layer stores called from disk_usage.go

func (*ImageService) LayerStoreStatus

func (i *ImageService) LayerStoreStatus() [][2]string

LayerStoreStatus returns the status for each layer store called from info.go

func (*ImageService) LoadImage

func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error

LoadImage uploads a set of images into the repository. This is the complement of ExportImage. The input stream is an uncompressed tar ball containing images and metadata.

TODO(thaJeztah): produce JSON stream progress response and image events; see https://github.com/moby/moby/issues/43910

func (*ImageService) LogImageEvent

func (i *ImageService) LogImageEvent(imageID, refName, action string)

LogImageEvent generates an event related to an image with only the default attributes.

func (*ImageService) LogImageEventWithAttributes

func (i *ImageService) LogImageEventWithAttributes(imageID, refName, action string, attributes map[string]string)

LogImageEventWithAttributes generates an event related to an image with specific given attributes.

func (*ImageService) MakeImageCache

func (i *ImageService) MakeImageCache(ctx context.Context, cacheFrom []string) (builder.ImageCache, error)

MakeImageCache creates a stateful image cache.

func (*ImageService) PullImage

func (i *ImageService) PullImage(ctx context.Context, image, tagOrDigest string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error

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

func (*ImageService) PushImage

func (i *ImageService) PushImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error

PushImage initiates a push operation on the repository named localName.

func (*ImageService) ReleaseLayer

func (i *ImageService) ReleaseLayer(rwlayer layer.RWLayer) error

ReleaseLayer releases a layer allowing it to be removed called from delete.go Daemon.cleanupContainer(), and Daemon.containerExport()

func (*ImageService) SearchRegistryForImages

func (i *ImageService) SearchRegistryForImages(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *registry.AuthConfig, metaHeaders map[string][]string) (*registry.SearchResults, error)

SearchRegistryForImages queries the registry for images matching term. authConfig is used to login.

TODO: this could be implemented in a registry service instead of the image service.

func (*ImageService) SquashImage

func (i *ImageService) SquashImage(id, parent string) (string, error)

SquashImage creates a new image with the diff of the specified image and the specified parent. This new image contains only the layers from its parent + 1 extra layer which contains the diff of all the layers in between. The existing image(s) is not destroyed. If no parent is specified, a new image with the diff of all the specified image's layers merged into a new layer that has no parents.

func (*ImageService) StorageDriver

func (i *ImageService) StorageDriver() string

StorageDriver returns the name of the default storage-driver (snapshotter) used by the ImageService.

func (*ImageService) TagImage

func (i *ImageService) TagImage(imageName, repository, tag string) (string, error)

TagImage creates the tag specified by newTag, pointing to the image named imageName (alternatively, imageName can also be an image ID).

func (*ImageService) TagImageWithReference

func (i *ImageService) TagImageWithReference(imageID image.ID, newTag reference.Named) error

TagImageWithReference adds the given reference to the image ID provided.

func (*ImageService) UpdateConfig

func (i *ImageService) UpdateConfig(maxDownloads, maxUploads int)

UpdateConfig values

called from reload.go

Jump to

Keyboard shortcuts

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