docker

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	FindImage(string) (*dc.Image, error)
	PullImage(string, string) error
	FindContainer(string) (*dc.Container, error)
	CreateContainer(dc.CreateContainerOptions) (*dc.Container, error)
	StartContainer(string, string) error
	ConnectNetwork(string, *dc.Container) error
}

APIClient provides access to docker

type Client

type Client struct {
	*dc.Client
	PullInactivityTimeout time.Duration
}

Client provides api access to Docker

func NewDockerClient

func NewDockerClient() (*Client, error)

NewDockerClient returns a docker client with the default configuration

func (*Client) ConnectNetwork

func (c *Client) ConnectNetwork(name string, container *dc.Container) error

ConnectNetwork connects the container to a network

func (*Client) CreateContainer

func (c *Client) CreateContainer(opts dc.CreateContainerOptions) (*dc.Container, error)

CreateContainer creates a container with the specified options

func (*Client) CreateNetwork

func (c *Client) CreateNetwork(opts dc.CreateNetworkOptions) (*dc.Network, error)

CreateNetwork creates a docker network

func (*Client) CreateVolume

func (c *Client) CreateVolume(opts dc.CreateVolumeOptions) (*dc.Volume, error)

CreateVolume creates a docker volume

func (*Client) FindContainer

func (c *Client) FindContainer(name string) (*dc.Container, error)

FindContainer returns a container matching the specified name

func (*Client) FindImage

func (c *Client) FindImage(repoTag string) (*dc.Image, error)

FindImage finds a local docker image with the specified repo tag

func (*Client) FindNetwork

func (c *Client) FindNetwork(name string) (*dc.Network, error)

FindNetwork finds the network with the specified name

func (*Client) FindVolume

func (c *Client) FindVolume(name string) (*dc.Volume, error)

FindVolume finds the volume with the specified name

func (*Client) ListNetworks

func (c *Client) ListNetworks() ([]dc.Network, error)

ListNetworks returns the docker networks

func (*Client) PullImage

func (c *Client) PullImage(name, tag string) error

PullImage pulls an image with the specified name and tag

func (*Client) RemoveNetwork

func (c *Client) RemoveNetwork(name string) error

RemoveNetwork removes a docker volume

func (*Client) RemoveVolume

func (c *Client) RemoveVolume(name string) error

RemoveVolume removes a docker volume

func (*Client) StartContainer

func (c *Client) StartContainer(name, containerID string) error

StartContainer starts the container with the specified ID

type NetworkClient

type NetworkClient interface {
	ListNetworks() ([]dc.Network, error)
	FindNetwork(string) (*dc.Network, error)
	CreateNetwork(dc.CreateNetworkOptions) (*dc.Network, error)
	RemoveNetwork(string) error
}

NetworkClient manage Docker networks

type Port

type Port struct {
	dc.Port
}

Port represents a docker port specification

func NewPort

func NewPort(s string) Port

NewPort creates a new Port

func (Port) PortNum

func (p Port) PortNum() string

PortNum returns the port as a string

func (Port) String

func (p Port) String() string

String returns the port as a string with Port and Protocol

func (Port) ToDockerClientPort

func (p Port) ToDockerClientPort() dc.Port

ToDockerClientPort returns a dc.Port from a Port

type VolumeClient

type VolumeClient interface {
	FindVolume(string) (*dc.Volume, error)
	CreateVolume(dc.CreateVolumeOptions) (*dc.Volume, error)
	RemoveVolume(string) error
}

VolumeClient manages Docker volumes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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