docker

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineImageNameAndTag

func CombineImageNameAndTag(imageName, tag string) string

func IfVolumesDiffer

func IfVolumesDiffer(volumesBefore, volumesCurrent []string) bool

Types

type MountPoint

type MountPoint struct {
	Type        string `json:"Type"`
	Source      string `json:"Source"`
	Destination string `json:"Destination"`
	Mode        string `json:"Mode"`
	Rw          bool   `json:"RW"`
	Propagation string `json:"Propagation"`
}

type Mounts

type Mounts []MountPoint

func (Mounts) ExtractSources

func (ms Mounts) ExtractSources() []string

ExtractSources returns a list of sources for the given mounts

type Operator

type Operator interface {
	ImageIfExist(imageNameWithTag string) bool
	ImagePull(imageNameWithTag string) error
	ImageRemove(imageNameWithTag string) error

	ContainerIfExist(containerName string) bool
	ContainerIfRunning(containerName string) bool
	// ContainerRun runs a container with the given options
	// params is a list of additional parameters for docker run
	// params will be appended to the end of the command
	ContainerRun(opts *RunOptions) error
	ContainerStop(containerName string) error
	ContainerRemove(containerName string) error

	// ContainerListMounts lists container mounts
	ContainerListMounts(containerName string) (Mounts, error)

	ContainerGetHostname(containerName string) (string, error)
	ContainerListPortPublishes(containerName string) ([]PortPublish, error)
	ContainerGetPortBinding(containerName string, containerPort uint) (hostPort uint, err error)

	ComposeUp() error
	ComposeDown() error
	ComposeState() (map[string]interface{}, error)
}

Operator is an interface for docker operations It is implemented by shDockerOperator in the future, we can add other implementations such as SdkDockerOperator

type PortPublish

type PortPublish struct {
	HostPort      uint
	ContainerPort uint
}

RunOptions is used to pass options to ContainerRunWithOptions

type RunOptions

type RunOptions struct {
	ImageName     string
	ImageTag      string
	Hostname      string
	ContainerName string
	PortPublishes []PortPublish
	Volumes       Volumes
	RestartAlways bool
	RunParams     []string
}

RunOptions is used to pass options to ContainerRunWithOptions

func (*RunOptions) Validate

func (opts *RunOptions) Validate() error

type Volume

type Volume struct {
	HostPath      string
	ContainerPath string
}

RunOptions is used to pass options to ContainerRunWithOptions

type Volumes

type Volumes []Volume

RunOptions is used to pass options to ContainerRunWithOptions

func (Volumes) ExtractHostPaths

func (volumes Volumes) ExtractHostPaths() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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