images

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2017 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Package is used to identify working containers
	Package = "kpod"

	// OCIv1ImageManifest is the MIME type of an OCIv1 image manifest,
	// suitable for specifying as a value of the PreferredManifestType
	// member of a CommitOptions structure.  It is also the default.
	OCIv1ImageManifest = v1.MediaTypeImageManifest
)
View Source
const (
	// DefaultRegistry is a prefix that we apply to an image name
	// to check docker hub first for the image
	DefaultRegistry = "docker://"
)

Variables

This section is empty.

Functions

func FindImage

func FindImage(store storage.Store, image string) (*storage.Image, error)

FindImage searches for a *storage.Image with a matching the given name or ID in the given store.

func FindImageRef

func FindImageRef(store storage.Store, image string) (types.Image, error)

FindImageRef searches for and returns a new types.Image matching the given name or ID in the given store.

func FormattedSize

func FormattedSize(size float64) string

FormattedSize returns a human-readable formatted size for the image

func GetImagesMatchingFilter

func GetImagesMatchingFilter(store storage.Store, filter *FilterParams, argName string) ([]storage.Image, error)

GetImagesMatchingFilter returns a slice of all images in the store that match the provided FilterParams. Images with more than one name matching the filter will be in the slice once for each name

func InfoAndDigestAndSize

func InfoAndDigestAndSize(store storage.Store, img storage.Image) (*types.ImageInspectInfo, digest.Digest, int64, error)

InfoAndDigestAndSize returns the inspection info and size of the image in the given store and the digest of its manifest, if it has one, or "" if it doesn't.

func MatchesID

func MatchesID(id, argID string) bool

MatchesID returns true if argID is a full or partial match for id

func MatchesReference

func MatchesReference(name, argName string) bool

MatchesReference returns true if argName is a full or partial match for name Partial matches will register only if they match the most specific part of the name available For example, take the image docker.io/library/redis:latest redis, library,redis, docker.io/library/redis, redis:latest, etc. will match But redis:alpine, ry/redis, library, and io/library/redis will not

func ParseImageNames

func ParseImageNames(names []string) (tags, digests []string, err error)

ParseImageNames parses the names we've stored with an image into a list of tagged references and a list of references which contain digests.

func PullImage

func PullImage(store storage.Store, imgName string, allTags, quiet bool, sc *types.SystemContext) error

PullImage copies the image from the source to the destination

func PushImage

func PushImage(srcName, destName string, options CopyOptions) error

PushImage pushes the src image to the destination

func RemoveImage

func RemoveImage(image *storage.Image, store storage.Store) (string, error)

RemoveImage removes the given image from storage

func UntagImage

func UntagImage(store storage.Store, image *storage.Image, imgArg string) (string, error)

UntagImage removes the tag from the given image

Types

type CopyData

type CopyData struct {

	// Type is used to help identify a build container's metadata.  It
	// should not be modified.
	Type string `json:"type"`
	// FromImage is the name of the source image which was used to create
	// the container, if one was used.  It should not be modified.
	FromImage string `json:"image,omitempty"`
	// FromImageID is the ID of the source image which was used to create
	// the container, if one was used.  It should not be modified.
	FromImageID string `json:"image-id"`
	// Config is the source image's configuration.  It should not be
	// modified.
	Config []byte `json:"config,omitempty"`
	// Manifest is the source image's manifest.  It should not be modified.
	Manifest []byte `json:"manifest,omitempty"`

	// Container is the name of the build container.  It should not be modified.
	Container string `json:"container-name,omitempty"`
	// ContainerID is the ID of the build container.  It should not be modified.
	ContainerID string `json:"container-id,omitempty"`
	// MountPoint is the last location where the container's root
	// filesystem was mounted.  It should not be modified.
	MountPoint string `json:"mountpoint,omitempty"`

	// ImageAnnotations is a set of key-value pairs which is stored in the
	// image's manifest.
	ImageAnnotations map[string]string `json:"annotations,omitempty"`
	// ImageCreatedBy is a description of how this container was built.
	ImageCreatedBy string `json:"created-by,omitempty"`

	// Image metadata and runtime settings, in multiple formats.
	OCIv1  v1.Image       `json:"ociv1,omitempty"`
	Docker docker.V2Image `json:"docker,omitempty"`
	// contains filtered or unexported fields
}

CopyData stores the basic data used when copying a container or image

func GetContainerCopyData

func GetContainerCopyData(store storage.Store, name string) (*CopyData, error)

GetContainerCopyData gets the copy data for a container

func GetImageCopyData

func GetImageCopyData(store storage.Store, image string) (*CopyData, error)

GetImageCopyData gets the copy data for an image

func ImportCopyDataFromImage

func ImportCopyDataFromImage(store storage.Store, systemContext *types.SystemContext, imageID, containerName, containerID string) (*CopyData, error)

ImportCopyDataFromImage creates copy data for an image with the given parameters

func (*CopyData) Annotations

func (c *CopyData) Annotations() map[string]string

Annotations gets the anotations of the container or image

func (*CopyData) Architecture

func (c *CopyData) Architecture() string

Architecture returns a name of the architecture on which a container built using this image is intended to be run.

func (*CopyData) MakeImageRef

func (c *CopyData) MakeImageRef(manifestType string, compress archive.Compression, names []string, layerID string, historyTimestamp *time.Time) (types.ImageReference, error)

MakeImageRef converts a CopyData struct into a types.ImageReference

func (*CopyData) OS

func (c *CopyData) OS() string

OS returns a name of the OS on which a container built using this image is intended to be run.

func (*CopyData) Save

func (c *CopyData) Save() error

Save the CopyData to disk

func (*CopyData) SetArchitecture

func (c *CopyData) SetArchitecture(arch string)

SetArchitecture sets the name of the architecture on which ta container built using this image is intended to be run.

func (*CopyData) SetOS

func (c *CopyData) SetOS(os string)

SetOS sets the name of the OS on which a container built using this image is intended to be run.

func (*CopyData) SetWorkDir

func (c *CopyData) SetWorkDir(there string)

SetWorkDir sets the location of the default working directory for running commands in a container built using this image.

func (*CopyData) WorkDir

func (c *CopyData) WorkDir() string

WorkDir returns the default working directory for running commands in a container built using this image.

type CopyOptions

type CopyOptions struct {
	// Compression specifies the type of compression which is applied to
	// layer blobs.  The default is to not use compression, but
	// archive.Gzip is recommended.
	Compression archive.Compression
	// SignaturePolicyPath specifies an override location for the signature
	// policy which should be used for verifying the new image as it is
	// being written.  Except in specific circumstances, no value should be
	// specified, indicating that the shared, system-wide default policy
	// should be used.
	SignaturePolicyPath string
	// ReportWriter is an io.Writer which will be used to log the writing
	// of the new image.
	ReportWriter io.Writer
	// Store is the local storage store which holds the source image.
	Store storage.Store
	// DockerRegistryOptions encapsulates settings that affect how we
	// connect or authenticate to a remote registry to which we want to
	// push the image.
	common.DockerRegistryOptions
	// SigningOptions encapsulates settings that control whether or not we
	// strip or add signatures to the image when pushing (uploading) the
	// image to a registry.
	common.SigningOptions
}

CopyOptions contains the options given when pushing or pulling images

type CopyRef

type CopyRef struct {
	// contains filtered or unexported fields
}

CopyRef handles image references used for copying images to/from remotes

func (*CopyRef) DeleteImage

func (c *CopyRef) DeleteImage(*types.SystemContext) error

DeleteImage deletes an image in the CopyRef

func (*CopyRef) DockerReference

func (c *CopyRef) DockerReference() reference.Named

DockerReference gets the docker reference for the given CopyRef

func (*CopyRef) NewImage

func (c *CopyRef) NewImage(sc *types.SystemContext) (types.Image, error)

NewImage creates a new image from the given system context

func (*CopyRef) NewImageDestination

func (c *CopyRef) NewImageDestination(sc *types.SystemContext) (types.ImageDestination, error)

NewImageDestination creates a new image destination from the given system context

func (*CopyRef) NewImageSource

func (c *CopyRef) NewImageSource(sc *types.SystemContext, manifestTypes []string) (src types.ImageSource, err error)

NewImageSource creates a new image source from the given system context and manifest

func (*CopyRef) PolicyConfigurationIdentity

func (c *CopyRef) PolicyConfigurationIdentity() string

PolicyConfigurationIdentity returns the policy configuration for the CopyRef

func (*CopyRef) PolicyConfigurationNamespaces

func (c *CopyRef) PolicyConfigurationNamespaces() []string

PolicyConfigurationNamespaces returns the policy configuration namespace for the CopyRef

func (*CopyRef) StringWithinTransport

func (c *CopyRef) StringWithinTransport() string

StringWithinTransport returns the first name of the copyRef

func (*CopyRef) Transport

func (c *CopyRef) Transport() types.ImageTransport

Transport returns an ImageTransport for the given CopyRef

type Data

type Data struct {
	ID           string
	Tags         []string
	Digests      []string
	Digest       digest.Digest
	Comment      string
	Created      *time.Time
	Container    string
	Author       string
	Config       ociv1.ImageConfig
	Architecture string
	OS           string
	Annotations  map[string]string
	CreatedBy    string
	Size         uint
	VirtualSize  uint
	GraphDriver  driver.Data
	RootFS       ociv1.RootFS
}

Data handles the data used when inspecting a container nolint

func GetData

func GetData(store storage.Store, name string) (*Data, error)

GetData gets the Data for a container with the given name in the given store.

type FilterParams

type FilterParams struct {
	// contains filtered or unexported fields
}

FilterParams contains the filter options that may be given when outputting images

func ParseFilter

func ParseFilter(store storage.Store, filter string) (*FilterParams, error)

ParseFilter takes a set of images and a filter string as input, and returns the

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL