dockerClient

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDockerTimeout      = errors.New("Timed out waiting for docker to start")
	ErrCouldntStartDocker = errors.New("Couldn't start docker daemon. Try starting it manually")
)
View Source
var DefaultClient = New()

A default client the is already connected to Docker

Functions

func Connect

func Connect() error

func ContainerExec

func ContainerExec(id string, command []string) (resp types.ContainerExecInspect, err error)

func CreateNetwork

func CreateNetwork(s string) (id string, err error)

func Images

func Images() ([]types.ImageSummary, error)

func IsDockerRunning

func IsDockerRunning() bool

func IsImagePulled

func IsImagePulled(image string) (status bool, err error)

func NetworkByID

func NetworkByID(s string) (types.NetworkResource, error)

func NetworkByName

func NetworkByName(s string) (types.NetworkResource, error)

Network

func PullImage

func PullImage(image string, pull bool) (err error)

Image

func RemoveImage

func RemoveImage(image string) (err error)

func RunContainer

func RunContainer(config *container.Config, hostConfig *container.HostConfig) (container.ContainerCreateCreatedBody, error)

RunContainer creates and starts a container with given options

func StartDocker

func StartDocker() error

Types

type CLI

type CLI struct {
	Client *client.Client
	Ctx    context.Context
}

func (*CLI) Connect

func (c *CLI) Connect() (err error)

func (*CLI) ContainerExec

func (c *CLI) ContainerExec(id string, command []string) (resp types.ContainerExecInspect, err error)

func (*CLI) CreateNetwork

func (c *CLI) CreateNetwork(name string) (id string, err error)

func (*CLI) DockerAPIversion

func (c *CLI) DockerAPIversion() (version string)

func (*CLI) Images

func (c *CLI) Images() ([]types.ImageSummary, error)

func (*CLI) IsDockerRunning

func (c *CLI) IsDockerRunning() bool

func (*CLI) IsImagePulled

func (c *CLI) IsImagePulled(image string) (status bool, err error)

func (*CLI) NetworkByID

func (c *CLI) NetworkByID(id string) (network types.NetworkResource, err error)

func (*CLI) NetworkByName

func (c *CLI) NetworkByName(name string) (network types.NetworkResource, err error)

func (*CLI) PullImage

func (c *CLI) PullImage(image string, pull bool) (err error)

func (*CLI) RemoveImage

func (c *CLI) RemoveImage(image string) (err error)

func (*CLI) RunContainer

func (c *CLI) RunContainer(config *container.Config, hostConfig *container.HostConfig) (container container.ContainerCreateCreatedBody, err error)

func (*CLI) StartDocker

func (c *CLI) StartDocker() error

type Client

type Client interface {
	Connect() (err error)
	IsDockerRunning() bool
	StartDocker() error

	// Network methods
	DockerNetwork

	// Image methods
	DockerImage

	// Container methods
	DockerContainer
	// contains filtered or unexported methods
}

func New

func New() Client

type DockerContainer

type DockerContainer interface {
	RunContainer(config *container.Config, hostConfig *container.HostConfig) (container.ContainerCreateCreatedBody, error)
	ContainerExec(id string, command []string) (resp types.ContainerExecInspect, err error)
}

type DockerImage

type DockerImage interface {
	PullImage(image string, pull bool) (err error)
	IsImagePulled(image string) (status bool, err error)
	RemoveImage(image string) (err error)
	Images() ([]types.ImageSummary, error)
}

type DockerNetwork

type DockerNetwork interface {
	NetworkByID(id string) (network types.NetworkResource, err error)
	NetworkByName(name string) (network types.NetworkResource, err error)
	CreateNetwork(name string) (id string, err error)
}

Jump to

Keyboard shortcuts

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