docker: Index | Files | Directories

package image

import ""


Package Files

fs.go image.go rootfs.go store.go


const TypeLayers = "layers"

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

type ChildConfig Uses

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 Uses

type DigestWalkFunc func(id digest.Digest) error

DigestWalkFunc is function called by StoreBackend.Walk

type Exporter Uses

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 Uses

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

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

type ID Uses

type ID digest.Digest

ID is the content-addressable ID of an image.

func IDFromDigest Uses

func IDFromDigest(digest digest.Digest) ID

IDFromDigest creates an ID from a digest

func (ID) Digest Uses

func (id ID) Digest() digest.Digest

Digest converts ID into a digest

func (ID) String Uses

func (id ID) String() string

type Image Uses

type Image struct {
    Parent     ID        `json:"parent,omitempty"` //nolint:govet
    RootFS     *RootFS   `json:"rootfs,omitempty"`
    History    []History `json:"history,omitempty"`
    OSVersion  string    `json:"os.version,omitempty"`
    OSFeatures []string  `json:"os.features,omitempty"`
    // contains filtered or unexported fields

Image stores the image configuration

func NewChildImage Uses

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

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

func NewFromJSON Uses

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

NewFromJSON creates an Image configuration from json.

func (*Image) BaseImgArch Uses

func (img *Image) BaseImgArch() string

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

func (*Image) BaseImgVariant Uses

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 Uses

func (img *Image) ID() ID

ID returns the image's content-addressable ID.

func (*Image) ImageID Uses

func (img *Image) ImageID() string

ImageID stringifies ID.

func (*Image) MarshalJSON Uses

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 Uses

func (img *Image) OperatingSystem() string

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

func (*Image) RawJSON Uses

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

RawJSON returns the immutable JSON associated with the image.

func (*Image) RunConfig Uses

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

RunConfig returns the image's container config.

type LayerGetReleaser Uses

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 Uses

type RootFS struct {
    Type    string         `json:"type"`
    DiffIDs []layer.DiffID `json:"diff_ids,omitempty"`

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 Uses

func NewRootFS() *RootFS

NewRootFS returns empty RootFS struct

func (*RootFS) Append Uses

func (r *RootFS) Append(id layer.DiffID)

Append appends a new diffID to rootfs

func (*RootFS) ChainID Uses

func (r *RootFS) ChainID() layer.ChainID

ChainID returns the ChainID for the top layer in RootFS.

func (*RootFS) Clone Uses

func (r *RootFS) Clone() *RootFS

Clone returns a copy of the RootFS

type Store Uses

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

func NewImageStore(fs StoreBackend, lss map[string]LayerGetReleaser) (Store, error)

NewImageStore returns new store object for given set of layer stores

type StoreBackend Uses

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 Uses

func NewFSStoreBackend(root string) (StoreBackend, error)

NewFSStoreBackend returns new filesystem based backend for image.Store

type V1Image Uses

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
    Parent string `json:"parent,omitempty"`
    // Comment is the commit message that was set when committing 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 used to commit
    Container string `json:"container,omitempty"`
    // ContainerConfig is the configuration of the container that is committed into the image
    ContainerConfig container.Config `json:"container_config,omitempty"`
    // DockerVersion specifies the version of Docker that was used to build the image
    DockerVersion string `json:"docker_version,omitempty"`
    // Author is the name of the author that was specified when committing the image
    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 that the image is built and 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 used to build and run the image
    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.



Package image imports 20 packages (graph) and is imported by 5313 packages. Updated 2021-01-20. Refresh now. Tools for package owners.