image

package
v23.0.9+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const TypeLayers = "layers"

TypeLayers is used for RootFS.Type for filesystems organized into layers.

Variables

This section is empty.

Functions

This section is empty.

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 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

type History struct {
	// Created is the timestamp at which the image was created
	Created time.Time `json:"created"`
	// 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"`
	// CreatedBy keeps the Dockerfile command used while building the image
	CreatedBy string `json:"created_by,omitempty"`
	// Comment is the commit message that was set when committing the image
	Comment string `json:"comment,omitempty"`
	// EmptyLayer is set to true if this history item did not generate a
	// layer. Otherwise, the history item is associated with the next
	// layer in the RootFS section.
	EmptyLayer bool `json:"empty_layer,omitempty"`
}

History stores build commands that were used to create an image

func NewHistory

func NewHistory(author, comment, createdBy string, isEmptyLayer bool) History

NewHistory creates a new history struct from arguments, and sets the created time to the current time in UTC

func (History) Equal

func (h History) Equal(i History) bool

Equal compares two history structs for equality

type ID

type ID digest.Digest

ID is the content-addressable ID of an image.

func IDFromDigest

func IDFromDigest(digest digest.Digest) ID

IDFromDigest creates an ID from a digest

func (ID) Digest

func (id ID) Digest() digest.Digest

Digest converts ID into a digest

func (ID) String

func (id ID) String() 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"`
	// contains filtered or unexported fields
}

Image stores the image configuration

func NewChildImage

func NewChildImage(img *Image, child ChildConfig, os string) *Image

NewChildImage creates a new Image as a child of this image.

func NewFromJSON

func NewFromJSON(src []byte) (*Image, error)

NewFromJSON creates an Image configuration from json.

func (*Image) BaseImgArch

func (img *Image) BaseImgArch() string

BaseImgArch returns the image's architecture. If not populated, defaults to the host runtime arch.

func (*Image) BaseImgVariant

func (img *Image) BaseImgVariant() string

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

func (img *Image) ID() ID

ID returns the image's content-addressable ID.

func (*Image) ImageID

func (img *Image) ImageID() string

ImageID stringifies ID.

func (*Image) MarshalJSON

func (img *Image) MarshalJSON() ([]byte, error)

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

func (img *Image) OperatingSystem() string

OperatingSystem returns the image's operating system. If not populated, defaults to the host runtime OS.

func (*Image) RawJSON

func (img *Image) RawJSON() []byte

RawJSON returns the immutable JSON associated with the image.

func (*Image) RunConfig

func (img *Image) RunConfig() *container.Config

RunConfig returns the image's container config.

type LayerGetReleaser

type LayerGetReleaser interface {
	Get(layer.ChainID) (layer.Layer, error)
	Release(layer.Layer) ([]layer.