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-09-14 11:40:26 +00:00
|
|
|
PullImage(ctx context.Context, ref reference.Named, 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-11-24 18:04:31 +00:00
|
|
|
ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetype.DeleteResponse, 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
|
2023-07-07 11:40:24 +00:00
|
|
|
Images(ctx context.Context, opts imagetype.ListOptions) ([]*imagetype.Summary, error)
|
2023-08-26 13:24:46 +00:00
|
|
|
LogImageEvent(imageID, refName string, action events.Action)
|
2023-09-10 00:05:05 +00:00
|
|
|
CountImages(ctx context.Context) int
|
2022-06-28 12:09:10 +00:00
|
|
|
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
|
2024-01-20 15:01:43 +00:00
|
|
|
GetImage(ctx context.Context, refOrID string, options backend.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-09-16 18:06:12 +00:00
|
|
|
PrepareSnapshot(ctx context.Context, id string, parentImage string, platform *ocispec.Platform, setupInit func(string) error) error
|
2024-01-20 15:01:43 +00:00
|
|
|
GetImageManifest(ctx context.Context, refOrID string, options backend.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
|
|
|
|
|
2023-09-23 11:06:20 +00:00
|
|
|
GetLayerFolders(img *image.Image, rwLayer layer.RWLayer, containerID string) ([]string, error)
|
2022-06-28 12:09:10 +00:00
|
|
|
|
|
|
|
// 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)
|
|
|
|
}
|