Documentation ¶
Index ¶
- Constants
- Variables
- func FindImage(store storage.Store, image string) (*storage.Image, error)
- func FindImageRef(store storage.Store, image string) (types.Image, error)
- func FormattedSize(size float64) string
- func GetImagesMatchingFilter(store storage.Store, filter *FilterParams, argName string) ([]storage.Image, error)
- func InfoAndDigestAndSize(store storage.Store, img storage.Image) (*types.ImageInspectInfo, digest.Digest, int64, error)
- func MatchesID(id, argID string) bool
- func MatchesReference(name, argName string) bool
- func ParseImageNames(names []string) (tags, digests []string, err error)
- func PullImage(imgName string, allTags bool, options CopyOptions) error
- func PushImage(srcName, destName string, options CopyOptions) error
- func RemoveImage(image *storage.Image, store storage.Store) (string, error)
- func UntagImage(store storage.Store, image *storage.Image, imgArg string) (string, error)
- type CopyData
- func (c *CopyData) Annotations() map[string]string
- func (c *CopyData) Architecture() string
- func (c *CopyData) MakeImageRef(manifestType string, compress archive.Compression, names []string, ...) (types.ImageReference, error)
- func (c *CopyData) OS() string
- func (c *CopyData) Save() error
- func (c *CopyData) SetArchitecture(arch string)
- func (c *CopyData) SetOS(os string)
- func (c *CopyData) SetWorkDir(there string)
- func (c *CopyData) WorkDir() string
- type CopyOptions
- type CopyRef
- func (c *CopyRef) DeleteImage(*types.SystemContext) error
- func (c *CopyRef) DockerReference() reference.Named
- func (c *CopyRef) NewImage(sc *types.SystemContext) (types.Image, error)
- func (c *CopyRef) NewImageDestination(sc *types.SystemContext) (types.ImageDestination, error)
- func (c *CopyRef) NewImageSource(sc *types.SystemContext) (src types.ImageSource, err error)
- func (c *CopyRef) PolicyConfigurationIdentity() string
- func (c *CopyRef) PolicyConfigurationNamespaces() []string
- func (c *CopyRef) StringWithinTransport() string
- func (c *CopyRef) Transport() types.ImageTransport
- type Data
- type FilterParams
Constants ¶
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 )
const ( // DefaultRegistry is a prefix that we apply to an image name // to check docker hub first for the image DefaultRegistry = "docker://" )
Variables ¶
var ( // DockerArchive is the transport we prepend to an image name // when saving to docker-archive DockerArchive = dockerarchive.Transport.Name() // OCIArchive is the transport we prepend to an image name // when saving to oci-archive OCIArchive = ociarchive.Transport.Name() )
Functions ¶
func FindImage ¶
FindImage searches for a *storage.Image with a matching the given name or ID in the given store.
func FindImageRef ¶
FindImageRef searches for and returns a new types.Image matching the given name or ID in the given store.
func FormattedSize ¶
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 MatchesReference ¶
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 ¶
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(imgName string, allTags bool, options CopyOptions) 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 ¶
RemoveImage removes the given image from storage
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 ¶
GetContainerCopyData gets the copy data for a container
func GetImageCopyData ¶
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 ¶
Annotations gets the anotations of the container or image
func (*CopyData) Architecture ¶
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 ¶
OS returns a name of the OS on which a container built using this image is intended to be run.
func (*CopyData) SetArchitecture ¶
SetArchitecture sets the name of the architecture on which ta container built using this image is intended to be run.
func (*CopyData) SetOS ¶
SetOS sets the name of the OS on which a container built using this image is intended to be run.
func (*CopyData) SetWorkDir ¶
SetWorkDir sets the location of 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 // Quiet suppresses the output when a push or pull happens Quiet bool }
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 ¶
DockerReference gets the docker reference for the given CopyRef
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) (src types.ImageSource, err error)
NewImageSource creates a new image source from the given system context and manifest
func (*CopyRef) PolicyConfigurationIdentity ¶
PolicyConfigurationIdentity returns the policy configuration for the CopyRef
func (*CopyRef) PolicyConfigurationNamespaces ¶
PolicyConfigurationNamespaces returns the policy configuration namespace for the CopyRef
func (*CopyRef) StringWithinTransport ¶
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
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