dockerutil

package
v0.0.0-...-47a5711 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SaveImageInactivityTimeout         = 30
	CopyFromContainerInactivityTimeout = 30
)
View Source
const (
	CSCreated    = "created"
	CSRestarting = "restarting"
	CSRunning    = "running"
	CSRemoving   = "removing"
	CSPaused     = "paused"
	CSExited     = "exited"
	CSDead       = "dead"
)

Variables

View Source
var (
	ErrBadParam = errors.New("bad parameter")
	ErrNotFound = errors.New("not found")
)

Functions

func BuildEmptyImage

func BuildEmptyImage(dclient *dockerapi.Client) error

func CleanImageID

func CleanImageID(id string) string

func CopyFromContainer

func CopyFromContainer(dclient *dockerapi.Client, containerID, remote, local string, extract, removeOrig bool, inactivityTimeout int) error

func CopyToVolume

func CopyToVolume(
	dclient *dockerapi.Client,
	volumeName string,
	source string,
	dstRootDir string,
	dstTargetDir string) error

func CreateVolumeWithData

func CreateVolumeWithData(
	dclient *dockerapi.Client,
	source string,
	name string,
	labels map[string]string) error

func DeleteVolume

func DeleteVolume(dclient *dockerapi.Client, name string) error

func GenStateDirsTar

func GenStateDirsTar(rootDir, stateDir string) (io.Reader, error)

func GetContainerLogs

func GetContainerLogs(dclient *dockerapi.Client, containerID string, rawTerminal bool) (string, string, error)

func HasEmptyImage

func HasEmptyImage(dclient *dockerapi.Client) error

func HasVolume

func HasVolume(dclient *dockerapi.Client, name string) error

func ListContainers

func ListContainers(dclient *dockerapi.Client, nameFilter string, all bool) (map[string]BasicContainerProps, error)

func ListImages

func ListImages(dclient *dockerapi.Client, imageNameFilter string) (map[string]BasicImageProps, error)

func ListNetworks

func ListNetworks(dclient *dockerapi.Client, nameFilter string) ([]string, error)

func ListVolumeFiles

func ListVolumeFiles(dclient *dockerapi.Client, name string) ([]string, error)

func ListVolumes

func ListVolumes(dclient *dockerapi.Client, nameFilter string) ([]string, error)

func LoadImage

func LoadImage(dclient *dockerapi.Client,
	locaTarFilePath string,
	inputStream io.Reader,
	outputStream io.Writer) error

func PrepareContainerDataArchive

func PrepareContainerDataArchive(fullPath, newName, removePrefix string, removeOrig bool) error

func SaveImage

func SaveImage(dclient *dockerapi.Client, imageRef, local string, extract, removeOrig bool, inactivityTimeout int) error

func VolumePathExists

func VolumePathExists(dclient *dockerapi.Client, volume string, pth string) (bool, error)

Types

type BasicContainerProps

type BasicContainerProps struct {
	Name    string
	Names   []string //names have "/" as the prefix
	ID      string
	Image   string //'spec' image ref (inspect to get the exact image ID)
	Created int64
	State   string
	Status  string //e.g., "Up X seconds"
	Command string //Entrypoint+Cmd in the shell format
}

type BasicImageProps

type BasicImageProps struct {
	ID      string
	Size    int64
	Created int64
}

type ImageIdentity

type ImageIdentity struct {
	ID           string
	ShortTags    []string
	RepoTags     []string
	ShortDigests []string
	RepoDigests  []string
}

func APIImagesToIdentity

func APIImagesToIdentity(info *dockerapi.APIImages) *ImageIdentity

func HasImage

func HasImage(dclient *dockerapi.Client, imageRef string) (*ImageIdentity, error)

func ImageToIdentity

func ImageToIdentity(info *dockerapi.Image) *ImageIdentity

type VolumeInfo

type VolumeInfo struct {
	Created    time.Time
	Mountpoint string
	Size       uint64
	FileCount  uint64
}

func GetVolumeInfo

func GetVolumeInfo(dclient *dockerapi.Client, name string, fileCount bool) (*VolumeInfo, error)

Jump to

Keyboard shortcuts

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