image

package
v0.0.0-...-250839a Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const WhiteoutMetaPrefix = WhiteoutPrefix + WhiteoutPrefix
View Source
const WhiteoutOpaqueDir = WhiteoutMetaPrefix + ".opq"
View Source
const WhiteoutPrefix = ".wh."

Variables

This section is empty.

Functions

func CheckExist

func CheckExist(idOrName string) bool

func CheckNameOrID

func CheckNameOrID(args string) string

method to get imageId of a name or id return id

func FileInfoHeader

func FileInfoHeader(name string, fi os.FileInfo, link string) (*tar.Header, error)

FileInfoHeader creates a populated Header from fi. Compared to archive pkg this function fills in more information. Also, regardless of Go version, this function fills file type bits (e.g. hdr.Mode |= modeISDIR), which have been deleted since Go 1.9 archive/tar.

func GetImageFromDocker

func GetImageFromDocker(name string) (string, error)

func GetImageType

func GetImageType(imageID string) string

func ImportDocekrImage

func ImportDocekrImage(ctx context.Context, name, file string) (string, error)

func ImportImage

func ImportImage(path string) (string, error)

func ImportSaveDockerImage

func ImportSaveDockerImage(ctx context.Context, path string) (string, error)

func PullDockerImage

func PullDockerImage(ctx context.Context, name string) (string, error)

func QEMUImageSave

func QEMUImageSave(imageName string, imageType string, fileName string) (string, error)

func RunningInUserNS

func RunningInUserNS() bool

* Detect whether we are currently running in a user namespace. * Copied from github.com/lxc/lxd/shared/util.go

func SplitPathDirEntry

func SplitPathDirEntry(path string) (dir, base string)

SplitPathDirEntry splits the given path between its directory name and its basename by first cleaning the path but preserves a trailing "." if the original path specified the current directory.

func Untar

func Untar(tarfile, dstPath string) error

Types

type IDMap

type IDMap struct {
	ContainerID int `json:"container_id"`
	HostID      int `json:"host_id"`
	Size        int `json:"size"`
}

IDMap contains a single entry for user namespace range remapping. An array of IDMap entries represents the structure that will be provided to the Linux kernel for creating a user namespace.

type Identity

type Identity struct {
	UID int
	GID int
	SID string
}

Identity is either a UID and GID pair or a SID (but not both)

type IdentityMapping

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

IdentityMapping contains a mappings of UIDs and GIDs

func (*IdentityMapping) Empty

func (i *IdentityMapping) Empty() bool

Empty returns true if there are no id mappings

func (*IdentityMapping) ToContainer

func (i *IdentityMapping) ToContainer(pair Identity) (int, int, error)

ToContainer returns the container UID and GID for the host uid and gid

type Image

type Image interface {
	Remove() error
	Rename(string) error
	GetType() (bool, string)
	Register()
	UnRegister()
	GetPath() string
	GetName() string
	Export(string) error
}

func OpenImage

func OpenImage(id string) (Image, error)

type ImageEntry

type ImageEntry struct {
	Name          string    `json:"name"`
	ID            string    `json:"id"`
	CreateTime    time.Time `json:"create-time"`
	Type          string    `json:"type"` // docker_save, docker_raw, kvm_ios, kvm_qcow2
	IsDockerImage bool      `json:"is_docker_image"`
	Counter       int32     `json:"counter"`
}

func ListImage

func ListImage() []*ImageEntry

func (*ImageEntry) Export

func (image *ImageEntry) Export(target string) error

func (*ImageEntry) GetName

func (image *ImageEntry) GetName() string

func (*ImageEntry) GetPath

func (image *ImageEntry) GetPath() string

func (*ImageEntry) GetType

func (image *ImageEntry) GetType() (isDocker bool, imageType string)

func (*ImageEntry) Register

func (image *ImageEntry) Register()

func (*ImageEntry) Remove

func (image *ImageEntry) Remove() error

func (*ImageEntry) Rename

func (image *ImageEntry) Rename(name string) error

func (*ImageEntry) UnRegister

func (image *ImageEntry) UnRegister()

type WhiteoutFormat

type WhiteoutFormat int
const (
	// AUFSWhiteoutFormat is the default format for whiteouts
	AUFSWhiteoutFormat WhiteoutFormat = iota
	// OverlayWhiteoutFormat formats whiteout according to the overlay
	// standard.
	OverlayWhiteoutFormat
)

Jump to

Keyboard shortcuts

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