docker_helpers

package
v9.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2017 License: MIT Imports: 30 Imported by: 81

Documentation

Index

Constants

View Source
const DefaultDockerRegistry = "docker.io"

DefaultDockerRegistry is the name of the index

Variables

View Source
var HomeDirectory = homedir.Get()

Functions

func EncodeAuthConfig

func EncodeAuthConfig(authConfig *types.AuthConfig) (string, error)

EncodeAuthConfig constructs a token from an AuthConfig, suitable for authorizing against the Docker API with.

func IsErrNotFound

func IsErrNotFound(err error) bool

IsErrNotFound checks whether a returned error is due to an image or container not being found. Proxies the docker implementation.

func ReadAuthConfigsFromReader

func ReadAuthConfigsFromReader(r io.Reader) (map[string]types.AuthConfig, error)

func ReadDockerAuthConfigsFromHomeDir added in v1.8.0

func ReadDockerAuthConfigsFromHomeDir(userName string) (map[string]types.AuthConfig, error)

func ResolveDockerAuthConfig

func ResolveDockerAuthConfig(indexName string, configs map[string]types.AuthConfig) *types.AuthConfig

ResolveDockerAuthConfig taken from: https://github.com/docker/docker/blob/master/registry/auth.go

func SplitDockerImageName

func SplitDockerImageName(reposName string) (string, string)

SplitDockerImageName breaks a reposName into an index name and remote name

Types

type Client

type Client interface {
	ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)

	ImagePullBlocking(ctx context.Context, ref string, options types.ImagePullOptions) error
	ImageImportBlocking(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) error

	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
	ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
	ContainerWait(ctx context.Context, containerID string) (int64, error)
	ContainerKill(ctx context.Context, containerID, signal string) error
	ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
	ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
	ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)

	NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
	NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)

	Info(ctx context.Context) (types.Info, error)

	Close() error
}

func New

func New(c DockerCredentials, apiVersion string) (Client, error)

New attempts to create a new Docker client of the specified version.

If no host is given in the DockerCredentials, it will attempt to look up details from the environment. If that fails, it will use the default connection details for your platform.

type DockerCredentials

type DockerCredentials struct {
	Host      string `toml:"host,omitempty" json:"host" long:"host" env:"DOCKER_HOST" description:"Docker daemon address"`
	CertPath  string `toml:"tls_cert_path,omitempty" json:"tls_cert_path" long:"cert-path" env:"DOCKER_CERT_PATH" description:"Certificate path"`
	TLSVerify bool   `` /* 129-byte string literal not displayed */
}

type Machine

type Machine interface {
	Create(driver, name string, opts ...string) error
	Provision(name string) error
	Remove(name string) error
	List() (machines []string, err error)
	Exist(name string) bool

	CanConnect(name string) bool
	Credentials(name string) (DockerCredentials, error)
}

func NewMachineCommand

func NewMachineCommand() Machine

type MockClient added in v1.5.0

type MockClient struct {
	mock.Mock
}

func (*MockClient) Close

func (m *MockClient) Close() error

func (*MockClient) ContainerAttach

func (m *MockClient) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)

func (*MockClient) ContainerCreate

func (m *MockClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)

func (*MockClient) ContainerInspect

func (m *MockClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)

func (*MockClient) ContainerKill

func (m *MockClient) ContainerKill(ctx context.Context, containerID string, signal string) error

func (*MockClient) ContainerLogs

func (m *MockClient) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)

func (*MockClient) ContainerRemove

func (m *MockClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error

func (*MockClient) ContainerStart

func (m *MockClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error

func (*MockClient) ContainerWait

func (m *MockClient) ContainerWait(ctx context.Context, containerID string) (int64, error)

func (*MockClient) ImageImportBlocking

func (m *MockClient) ImageImportBlocking(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) error

func (*MockClient) ImageInspectWithRaw

func (m *MockClient) ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)

func (*MockClient) ImagePullBlocking

func (m *MockClient) ImagePullBlocking(ctx context.Context, ref string, options types.ImagePullOptions) error

func (*MockClient) Info added in v1.5.0

func (m *MockClient) Info(ctx context.Context) (types.Info, error)

func (*MockClient) NetworkDisconnect

func (m *MockClient) NetworkDisconnect(ctx context.Context, networkID string, containerID string, force bool) error

func (*MockClient) NetworkList

func (m *MockClient) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)

type MockMachine added in v1.5.0

type MockMachine struct {
	mock.Mock
}

func (*MockMachine) CanConnect added in v1.5.0

func (m *MockMachine) CanConnect(name string) bool

func (*MockMachine) Create added in v1.5.0

func (m *MockMachine) Create(driver string, name string, opts ...string) error

func (*MockMachine) Credentials added in v1.5.0

func (m *MockMachine) Credentials(name string) (DockerCredentials, error)

func (*MockMachine) Exist added in v1.5.0

func (m *MockMachine) Exist(name string) bool

func (*MockMachine) List added in v1.5.0

func (m *MockMachine) List() ([]string, error)

func (*MockMachine) Provision added in v1.5.0

func (m *MockMachine) Provision(name string) error

func (*MockMachine) Remove added in v1.5.0

func (m *MockMachine) Remove(name string) error

Jump to

Keyboard shortcuts

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