package image
import "github.com/docker/docker/image"
Index ¶
- Constants
- func CheckOS(os string) error
- type ChildConfig
- type Details
- type DigestWalkFunc
- type Exporter
- type History
- type ID
- type Image
- func Clone(base *Image, id ID) *Image
- func NewChildImage(img *Image, child ChildConfig, os string) *Image
- func NewFromJSON(src []byte) (*Image, error)
- func NewImage(id ID) *Image
- func (img *Image) BaseImgArch() string
- func (img *Image) BaseImgVariant() string
- func (img *Image) ID() ID
- func (img *Image) ImageID() string
- func (img *Image) MarshalJSON() ([]byte, error)
- func (img *Image) OperatingSystem() string
- func (img *Image) Platform() ocispec.Platform
- func (img *Image) RawJSON() []byte
- func (img *Image) RunConfig() *container.Config
- type LayerGetReleaser
- type RootFS
- func NewRootFS() *RootFS
- func (r *RootFS) Append(id layer.DiffID)
- func (r *RootFS) ChainID() layer.ChainID
- func (r *RootFS) Clone() *RootFS
- type Store
- type StoreBackend
- type V1Image
Constants ¶
const TypeLayers = "layers"
TypeLayers is used for RootFS.Type for filesystems organized into layers.
Functions ¶
func CheckOS ¶
CheckOS checks if the given OS matches the host's platform, and returns an error otherwise.
Types ¶
type ChildConfig ¶
type ChildConfig struct { ContainerID string Author string Comment string DiffID layer.DiffID ContainerConfig *container.Config Config *container.Config }
ChildConfig is the configuration to apply to an Image to create a new Child image. Other properties of the image are copied from the parent.
type Details ¶
type Details struct { References []reference.Named Size int64 Metadata map[string]string Driver string LastUpdated time.Time }
Details provides additional image data
type DigestWalkFunc ¶
type DigestWalkFunc func(id digest.Digest) error
DigestWalkFunc is function called by StoreBackend.Walk
type Exporter ¶
type Exporter interface { Load(io.ReadCloser, io.Writer, bool) error // TODO: Load(net.Context, io.ReadCloser, <- chan StatusMessage) error Save([]string, io.Writer) error }
Exporter provides interface for loading and saving images
type History ¶
History stores build commands that were used to create an image
func NewHistory ¶
NewHistory creates a new history struct from arguments, and sets the created time to the current time in UTC
type ID ¶
type ID digest.Digest
ID is the content-addressable ID of an image.
func (ID) Digest ¶
func (id ID) Digest() digest.Digest
Digest converts ID into a digest
func (ID) String ¶
type Image ¶
type Image struct { V1Image // Parent is the ID of the parent image. // // Depending on how the image was created, this field may be empty and // is only set for images that were built/created locally. This field // is empty if the image was pulled from an image registry. Parent ID `json:"parent,omitempty"` //nolint:govet // RootFS contains information about the image's RootFS, including the // layer IDs. RootFS *RootFS `json:"rootfs,omitempty"` History []History `json:"history,omitempty"` // OsVersion is the version of the Operating System the image is built to // run on (especially for Windows). OSVersion string `json:"os.version,omitempty"` OSFeatures []string `json:"os.features,omitempty"` // Details holds additional details about image Details *Details `json:"-"` // contains filtered or unexported fields }
Image stores the image configuration
func Clone ¶
Clone clones an image and changes ID.
func NewChildImage ¶
func NewChildImage(img *Image, child ChildConfig, os string) *Image
NewChildImage creates a new Image as a child of this image.
func NewFromJSON ¶
NewFromJSON creates an Image configuration from json.
func NewImage ¶
NewImage creates a new image with the given ID
func (*Image) BaseImgArch ¶
BaseImgArch returns the image's architecture. If not populated, defaults to the host runtime arch.
func (*Image) BaseImgVariant ¶
BaseImgVariant returns the image's variant, whether populated or not. This avoids creating an inconsistency where the stored image variant is "greater than" (i.e. v8 vs v6) the actual image variant.
func (*Image) ID ¶
ID returns the image's content-addressable ID.
func (*Image) ImageID ¶
ImageID stringifies ID.
func (*Image) MarshalJSON ¶
MarshalJSON serializes the image to JSON. It sorts the top-level keys so that JSON that's been manipulated by a push/pull cycle with a legacy registry won't end up with a different key order.
func (*Image) OperatingSystem ¶
OperatingSystem returns the image's operating system. If not populated, defaults to the host runtime OS.
func (*Image) Platform ¶
Platform generates an OCI platform from the image
func (*Image) RawJSON ¶
RawJSON returns the immutable JSON associated with the image.
func (*Image) RunConfig ¶
RunConfig returns the image's container config.
type LayerGetReleaser ¶
type LayerGetReleaser interface { Get(layer.ChainID) (layer.Layer, error) Release(layer.Layer) ([]layer.Metadata, error) }
LayerGetReleaser is a minimal interface for getting and releasing images.
type RootFS ¶
RootFS describes images root filesystem This is currently a placeholder that only supports layers. In the future this can be made into an interface that supports different implementations.
func NewRootFS ¶
func NewRootFS() *RootFS
NewRootFS returns empty RootFS struct
func (*RootFS) Append ¶
Append appends a new diffID to rootfs
func (*RootFS) ChainID ¶
ChainID returns the ChainID for the top layer in RootFS.
func (*RootFS) Clone ¶
Clone returns a copy of the RootFS
type Store ¶
type Store interface { Create(config []byte) (ID, error) Get(id ID) (*Image, error) Delete(id ID) ([]layer.Metadata, error) Search(partialID string) (ID, error) SetParent(id ID, parent ID) error GetParent(id ID) (ID, error) SetLastUpdated(id ID) error GetLastUpdated(id ID) (time.Time, error) SetBuiltLocally(id ID) error IsBuiltLocally(id ID) (bool, error) Children(id ID) []ID Map() map[ID]*Image Heads() map[ID]*Image Len() int }
Store is an interface for creating and accessing images
func NewImageStore ¶
func NewImageStore(fs StoreBackend, lss LayerGetReleaser) (Store, error)
NewImageStore returns new store object for given set of layer stores
type StoreBackend ¶
type StoreBackend interface { Walk(f DigestWalkFunc) error Get(id digest.Digest) ([]byte, error) Set(data []byte) (digest.Digest, error) Delete(id digest.Digest) error SetMetadata(id digest.Digest, key string, data []byte) error GetMetadata(id digest.Digest, key string) ([]byte, error) DeleteMetadata(id digest.Digest, key string) error }
StoreBackend provides interface for image.Store persistence
func NewFSStoreBackend ¶
func NewFSStoreBackend(root string) (StoreBackend, error)
NewFSStoreBackend returns new filesystem based backend for image.Store
type V1Image ¶
type V1Image struct { // ID is a unique 64 character identifier of the image ID string `json:"id,omitempty"` // Parent is the ID of the parent image. // // Depending on how the image was created, this field may be empty and // is only set for images that were built/created locally. This field // is empty if the image was pulled from an image registry. Parent string `json:"parent,omitempty"` // Comment is an optional message that can be set when committing or // importing the image. Comment string `json:"comment,omitempty"` // Created is the timestamp at which the image was created Created *time.Time `json:"created"` // Container is the ID of the container that was used to create the image. // // Depending on how the image was created, this field may be empty. Container string `json:"container,omitempty"` // ContainerConfig is the configuration of the container that was committed // into the image. ContainerConfig container.Config `json:"container_config,omitempty"` // DockerVersion is the version of Docker that was used to build the image. // // Depending on how the image was created, this field may be empty. DockerVersion string `json:"docker_version,omitempty"` // Author is the name of the author that was specified when committing the // image, or as specified through MAINTAINER (deprecated) in the Dockerfile. Author string `json:"author,omitempty"` // Config is the configuration of the container received from the client. Config *container.Config `json:"config,omitempty"` // Architecture is the hardware CPU architecture that the image runs on. Architecture string `json:"architecture,omitempty"` // Variant is the CPU architecture variant (presently ARM-only). Variant string `json:"variant,omitempty"` // OS is the Operating System the image is built to run on. OS string `json:"os,omitempty"` // Size is the total size of the image including all layers it is composed of. Size int64 `json:",omitempty"` }
V1Image stores the V1 image configuration.
Source Files ¶
fs.go image.go image_os.go rootfs.go store.go
Directories ¶
Path | Synopsis |
---|---|
image/cache | |
image/spec | |
image/spec/specs-go | Package v1 is deprecated and moved to github.com/moby/docker-image-spec/specs-go |
image/spec/specs-go/v1 | Package v1 is deprecated and moved to github.com/moby/docker-image-spec/specs-go/v1 |
image/tarexport | |
image/v1 |
- Version
- v26.0.0+incompatible
- Published
- Mar 20, 2024
- Platform
- js/wasm
- Imports
- 22 packages
- Last checked
- 1 second ago –
Tools for package owners.