driver

package
v0.0.0-...-0c3390c Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// defaultTimeout is the default timeout of short running docker operations.
	// Value is slightly offset from 2 minutes to make timeouts due to this
	// constant recognizable.
	DefaultTimeout = 2*time.Minute - 1*time.Second

	// defaultShmSize is the default ShmSize to use (in bytes) if not specified.
	DefaultShmSize = int64(1024 * 1024 * 64)

	// defaultImagePullingProgressReportInterval is the default interval of image pulling progress reporting.
	DefaultImagePullingProgressReportInterval = 10 * time.Second
)

Variables

View Source
var DockerDriver dockerClient
View Source
var PodmanDriver podmanClient

Functions

func RecreateContainer

func RecreateContainer(name string, dd Driver) error

Types

type ContainerBaseConfig

type ContainerBaseConfig struct {
	Hostname     string
	Image        string
	Env          map[string]string
	Cmd          []string
	HealthCheck  *HealthConfig
	Labels       map[string]string
	ExposedPorts nat.PortSet
}

type ContainerConfig

type ContainerConfig struct {
	Hostname     string
	ExposedPorts nat.PortSet
	Env          map[string]string
	Healthcheck  *HealthConfig
	Image        string
	Labels       map[string]string
}

type ContainerCreateOptions

type ContainerCreateOptions struct {
	Name             string
	ContainerConfig  *ContainerBaseConfig
	HostConfig       *ContainerHostConfig
	NetworkingConfig *ContainerNetworkingConfig
}

type ContainerCreateResponse

type ContainerCreateResponse struct {
	ID       string   `json:"Id"`
	Warnings []string `json:"Warnings"`
}

type ContainerHostConfig

type ContainerHostConfig struct {
	NetworkMode  string
	PortBindings nat.PortMap
	Mounts       []MountPoint
	Privileged   bool
}

type ContainerInspect

type ContainerInspect struct {
	// Base
	ID              string          `json:"Id"`
	Created         time.Time       `json:"Created"`
	Path            string          `json:"Path"`
	Args            []string        `json:"Args"`
	State           *ContainerState `json:"State"`
	Image           string          `json:"Image"`
	ImageName       string          `json:"ImageName"`
	Name            string          `json:"Name"`
	Mounts          []MountPoint
	Config          ContainerConfig        `json:"Config"`
	NetworkSettings ContainerNetworkConfig `json:"NetworkSettings`
}

NOTE: ContainerJSONBase for docker

InspectContainerData for podman

type ContainerListOptions

type ContainerListOptions struct {
	Filters map[string][]string
	All     bool
}

type ContainerNetworkConfig

type ContainerNetworkConfig struct {
	Gateway              string   `json:"Gateway"`
	IPAddress            string   `json:"IPAddress"`
	IPPrefixLen          int      `json:"IPPrefixLen"`
	SecondaryIPAddresses []string `json:"SecondaryIPAddresses,omitempty"`
	Networks             map[string]*NetworkEndpointSetting
}

type ContainerNetworkingConfig

type ContainerNetworkingConfig struct {
	EndpointsConfig map[string]*NetworkEndpointSetting
}

type ContainerState

type ContainerState struct {
	Status  string
	Running bool
	Paused  bool
}

type ContainerStatus

type ContainerStatus int

type ContainerSummary

type ContainerSummary struct {
	ID      string `json:"Id"`
	Names   []string
	Image   string
	ImageID string
	Command string
	Created int64
	Ports   []Port
	Labels  map[string]string
	State   string
	Status  string
	Mounts  []MountPoint
}

type Driver

type Driver interface {
	New() error
	ImageInspect(id string) (*ImageInspect, error)
	ImagesList(options ImageListOptions) ([]ImageSummary, error)
	ImagesPull(refStr string, options ImagePullOptions) ([]string, error)
	ImageVersion(id string) (string, error)
	ContainerCreate(options ContainerCreateOptions) (ContainerCreateResponse, error)
	ContainerStart(id string) error
	ContainerWait(id string, state string, timeout time.Duration, interval time.Duration) error
	ContainerList(options ContainerListOptions) ([]ContainerSummary, error)
	ContainerInspect(id string) (*ContainerInspect, error)
	ContainerRestart(id string) error
	ContainerStop(id string) error
	ContainerRemove(id string) error
	ContainerExec(id string, cmd []string) (ExecResult, error)
	NetworkCreate(name string, options NetworkCreateOptions) (NetworkCreateResponse, error)
	NetworkInspect(id string) (NetworkInspect, error)
	NetworkRemove(id string) error
	NetworkConnect(id string, container string, aliases []string) error
	NetworkDisconnect(id string, container string, force bool) error
	Info() (Info, error)
}

type EndpointResource

type EndpointResource struct {
	Name       string
	EndpointID string
}

corresponds to containers on a network

type ExecResult

type ExecResult struct {
	ExitCode  int
	OutBuffer *bytes.Buffer
	ErrBuffer *bytes.Buffer
}

func (*ExecResult) Stderr

func (res *ExecResult) Stderr() string

func (*ExecResult) Stdout

func (res *ExecResult) Stdout() string

type HealthConfig

type HealthConfig struct {
	Test        []string
	Interval    time.Duration
	Timeout     time.Duration
	StartPeriod time.Duration
	Retries     int
}

type ImageInspect

type ImageInspect struct {
	ID       string   `json:"Id"`
	Created  int64    `json:"Created"`
	RepoTags []string `json:",omitempty"`
	Size     int64    `json:"Size"`
}

type ImageListOptions

type ImageListOptions struct {
	Filters map[string][]string
	All     bool
}

type ImageNotFoundError

type ImageNotFoundError struct {
	ID string
}

type ImagePullOptions

type ImagePullOptions struct {
	Filters map[string][]string
	All     bool
}

type ImageSummary

type ImageSummary struct {
	ID          string            `json:"Id"`
	Created     int64             `json:"Created"`
	Labels      map[string]string `json:"Labels"`
	RepoTags    []string          `json:",omitempty"`
	RepoDigests []string          `json:",omitempty"`
	Size        int64             `json:"Size"`
}

type Info

type Info struct {
	ID              string
	Name            string
	KernelVersion   string
	OperatingSystem string
	OSVersion       string
	OSType          string
	Architecture    string
	ServerVersion   string
}

type MountPoint

type MountPoint struct {
	Type        MountType `json:",omitempty"`
	Name        string    `json:",omitempty"`
	Source      string
	Destination string
	Driver      string `json:"omitempty"`
	Mode        string
	RW          bool
	Propagation MountPropagation
}

type MountPropagation

type MountPropagation string
const (
	PropagationRPrivate MountPropagation = "rprivate"
	PropagationPrivate  MountPropagation = "private"
	PropagationRShared  MountPropagation = "rshared"
	PropagationShared   MountPropagation = "shared"
)

TODO all propagation consts

type MountType

type MountType string
const (
	TypeBind      MountType = "bind"
	TypeVolume    MountType = "volume"
	TypeTmpfs     MountType = "tmpsfs"
	TypeNamedPipe MountType = "npipe"
)

type NetworkCreateOptions

type NetworkCreateOptions struct {
	CheckDuplicate bool
	Driver         string
	Options        map[string]string
	Labels         map[string]string
}

type NetworkCreateResponse

type NetworkCreateResponse struct {
	ID      string `json:"Id"`
	Warning string
}

type NetworkEndpointSetting

type NetworkEndpointSetting struct {
	Links       []string
	Aliases     []string
	NetworkID   string
	EndpointID  string
	Gateway     string
	IPAddress   string
	IPPrefixLen int
}

type NetworkInspect

type NetworkInspect struct {
	Name       string
	NetworkID  string
	Containers map[string]EndpointResource
}

type NetworkListOptions

type NetworkListOptions struct {
	Filters map[string][]string
	All     bool
}

type PmWriteCloser

type PmWriteCloser struct {
	*bufio.Writer
}

func (*PmWriteCloser) Close

func (pwc *PmWriteCloser) Close() error

type Port

type Port struct {
	IP            string `json: "IP,omitempty"`
	ContainerPort uint16 `json:"ContainerPort"`
	HostPort      uint16 `json:"HostPort,omitempty"`
	Type          string `json:"Type"`
}

Jump to

Keyboard shortcuts

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