container

package
v0.0.0-...-cbea63e Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(image, tag string) error

func InspectContainer

func InspectContainer(name string) (*docker.Container, error)

func IsDownloaded

func IsDownloaded(image, tag string) bool

func IsRunning

func IsRunning(name string) bool

func ListContainers

func ListContainers(all bool) ([]docker.APIContainers, error)

func ListRunning

func ListRunning(filter string) ([]string, error)

func RemoveContainer

func RemoveContainer(name string) error

func RemoveImage

func RemoveImage(name string) error

func Start

func Start(image, tag string, config *Config) error

func Stop

func Stop(name string, timeout uint) error

Types

type Config

type Config struct {
	Image   string
	Command []string
	// Defaults to unlimited.
	Memory int
	// Defaults to unlimited.
	CPU     int
	Ports   []Port
	Volumes []Volume
}

Container Related Config Could be abstracted into an interface or moved to the docker class

type ContainerManager

type ContainerManager interface {
	Start(image, tag string, config *Config) error
	Stop(name string, timeout uint) error
	Download(image, tag string) error
	IsDownloaded(image, tag string) bool
	ListRunning(filter string) ([]string, error)
	ListContainers(all bool) ([]docker.APIContainers, error)
	IsRunning(name string) bool
	RemoveContainer(name string) error
	RemoveImage(name string) error
	InspectContainer(name string) (*docker.Container, error)
}

Manager abstracts the container interface

type Port

type Port struct {
	Id            string
	HostPort      int
	ContainerPort int
	Protocol      string
	HostIP        string
}

Port is a port mapping for a single container

type Volume

type Volume struct {
	Id         string
	ReadOnly   bool
	MounthPath string
}

Jump to

Keyboard shortcuts

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