2022-06-28 12:09:10 +00:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
|
2023-08-30 16:31:46 +00:00
|
|
|
"github.com/distribution/reference"
|
2022-06-28 12:09:10 +00:00
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"github.com/docker/docker/api/types/backend"
|
2023-08-26 13:24:46 +00:00
|
|
|
"github.com/docker/docker/api/types/events"
|
2022-06-28 12:09:10 +00:00
|
|
|
"github.com/docker/docker/api/types/filters"
|
|
|
|
imagetype "github.com/docker/docker/api/types/image"
|
|
|
|
"github.com/docker/docker/api/types/registry"
|
|
|
|
"github.com/docker/docker/builder"
|
|
|
|
"github.com/docker/docker/container"
|
|
|
|
"github.com/docker/docker/daemon/images"
|
|
|
|
"github.com/docker/docker/image"
|
|
|
|
"github.com/docker/docker/layer"
|
2023-03-23 11:32:59 +00:00
|
|
|
"github.com/docker/docker/pkg/archive"
|
2023-04-13 12:19:51 +00:00
|
|
|
"github.com/opencontainers/go-digest"
|
2023-05-08 09:57:52 +00:00
|
|
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
2022-06-28 12:09:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ImageService is a temporary interface to assist in the migration to the
|
|
|
|
// containerd image-store. This interface should not be considered stable,
|
|
|
|
// and may change over time.
|
|
|
|
type ImageService interface {
|
|
|
|
// Images
|
|
|
|
|
2023-05-08 09:57:52 +00:00
|
|
|
PullImage(ctx context.Context, name, tag string, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
|
2023-02-07 13:02:20 +00:00
|
|
|
PushImage(ctx context.Context, ref reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
|
2023-04-13 12:19:51 +00:00
|
|
|
CreateImage(ctx context.Context, config []byte, parent string, contentStoreDigest digest.Digest) (builder.Image, error)
|
2022-07-08 12:26:17 +00:00
|
|
|
ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
|
2022-07-11 09:46:07 +00:00
|
|
|
ExportImage(ctx context.Context, names []string, outStream io.Writer) error
|
2022-08-05 07:57:08 +00:00
|
|
|
PerformWithBaseFS(ctx context.Context, c *container.Container, fn func(string) error) error
|
2022-07-11 09:46:07 +00:00
|
|
|
LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error
|
2022-06-28 12:09:10 +00:00
|
|
|
Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error)
|
2023-08-26 13:24:46 +00:00
|
|
|
LogImageEvent(imageID, refName string, action events.Action)
|
2022-06-28 12:09:10 +00:00
|
|
|
CountImages() int
|
|
|
|
ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)
|
2023-05-08 09:57:52 +00:00
|
|
|
ImportImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error)
|
2023-01-10 13:29:40 +00:00
|
|
|
TagImage(ctx context.Context, imageID image.ID, newTag reference.Named) error
|
2022-08-09 12:42:50 +00:00
|
|
|
GetImage(ctx context.Context, refOrID string, options imagetype.GetImageOpts) (*image.Image, error)
|
2022-12-09 18:00:49 +00:00
|
|
|
ImageHistory(ctx context.Context, name string) ([]*imagetype.HistoryResponseItem, error)
|
2023-01-12 14:14:12 +00:00
|
|
|
CommitImage(ctx context.Context, c backend.CommitConfig) (image.ID, error)
|
2022-06-28 12:09:10 +00:00
|
|
|
SquashImage(id, parent string) (string, error)
|
|
|
|
|
2022-07-25 12:22:05 +00:00
|
|
|
// Containerd related methods
|
|
|
|
|
2023-05-08 09:57:52 +00:00
|
|
|
PrepareSnapshot(ctx context.Context, id string, image string, platform *ocispec.Platform) error
|
|
|
|
GetImageManifest(ctx context.Context, refOrID string, options imagetype.GetImageOpts) (*ocispec.Descriptor, error)
|
2022-07-25 12:22:05 +00:00
|
|
|
|
2022-06-28 12:09:10 +00:00
|
|
|
// Layers
|
|
|
|
|
|
|
|
GetImageAndReleasableLayer(ctx context.Context, refOrID string, opts backend.GetImageAndLayerOptions) (builder.Image, builder.ROLayer, error)
|
|
|
|
CreateLayer(container *container.Container, initFunc layer.MountInit) (layer.RWLayer, error)
|
|
|
|
LayerStoreStatus() [][2]string
|
|
|
|
GetLayerMountID(cid string) (string, error)
|
|
|
|
ReleaseLayer(rwlayer layer.RWLayer) error
|
|
|
|
LayerDiskUsage(ctx context.Context) (int64, error)
|
2023-03-06 15:02:37 +00:00
|
|
|
GetContainerLayerSize(ctx context.Context, containerID string) (int64, int64, error)
|
2022-07-25 12:22:05 +00:00
|
|
|
Mount(ctx context.Context, container *container.Container) error
|
|
|
|
Unmount(ctx context.Context, container *container.Container) error
|
2023-03-23 11:32:59 +00:00
|
|
|
Changes(ctx context.Context, container *container.Container) ([]archive.Change, error)
|
2022-06-28 12:09:10 +00:00
|
|
|
|
|
|
|
// Windows specific
|
|
|
|
|
|
|
|
GetLayerFolders(img *image.Image, rwLayer layer.RWLayer) ([]string, error)
|
|
|
|
|
|
|
|
// Build
|
|
|
|
|
2022-10-26 16:13:17 +00:00
|
|
|
MakeImageCache(ctx context.Context, cacheFrom []string) (builder.ImageCache, error)
|
2023-01-12 14:14:12 +00:00
|
|
|
CommitBuildStep(ctx context.Context, c backend.CommitConfig) (image.ID, error)
|
2022-06-28 12:09:10 +00:00
|
|
|
|
|
|
|
// Other
|
|
|
|
|
|
|
|
DistributionServices() images.DistributionServices
|
2023-04-13 13:07:17 +00:00
|
|
|
Children(ctx context.Context, id image.ID) ([]image.ID, error)
|
2022-06-28 12:09:10 +00:00
|
|
|
Cleanup() error
|
2022-08-09 15:03:50 +00:00
|
|
|
StorageDriver() string
|
2022-06-28 12:09:10 +00:00
|
|
|
UpdateConfig(maxDownloads, maxUploads int)
|
|
|
|
}
|