docker_helpers

package
v10.3.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: MIT Imports: 32 Imported by: 18

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
	Stop(name string, timeout time.Duration) 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
}

MockClient is an autogenerated mock type for the Client type

func (*MockClient) Close

func (_m *MockClient) Close() error

Close provides a mock function with given fields:

func (*MockClient) ContainerAttach

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

ContainerAttach provides a mock function with given fields: ctx, _a1, options

func (*MockClient) ContainerCreate

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

ContainerCreate provides a mock function with given fields: ctx, config, hostConfig, networkingConfig, containerName

func (*MockClient) ContainerInspect

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

ContainerInspect provides a mock function with given fields: ctx, containerID

func (*MockClient) ContainerKill

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

ContainerKill provides a mock function with given fields: ctx, containerID, signal

func (*MockClient) ContainerLogs

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

ContainerLogs provides a mock function with given fields: ctx, _a1, options

func (*MockClient) ContainerRemove

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

ContainerRemove provides a mock function with given fields: ctx, containerID, options

func (*MockClient) ContainerStart

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

ContainerStart provides a mock function with given fields: ctx, containerID, options

func (*MockClient) ContainerWait

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

ContainerWait provides a mock function with given fields: ctx, containerID

func (*MockClient) ImageImportBlocking

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

ImageImportBlocking provides a mock function with given fields: ctx, source, ref, options

func (*MockClient) ImageInspectWithRaw

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

ImageInspectWithRaw provides a mock function with given fields: ctx, imageID

func (*MockClient) ImagePullBlocking

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

ImagePullBlocking provides a mock function with given fields: ctx, ref, options

func (*MockClient) Info added in v1.5.0

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

Info provides a mock function with given fields: ctx

func (*MockClient) NetworkDisconnect

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

NetworkDisconnect provides a mock function with given fields: ctx, networkID, containerID, force

func (*MockClient) NetworkList

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

NetworkList provides a mock function with given fields: ctx, options

type MockMachine added in v1.5.0

type MockMachine struct {
	mock.Mock
}

MockMachine is an autogenerated mock type for the Machine type

func (*MockMachine) CanConnect added in v1.5.0

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

CanConnect provides a mock function with given fields: name

func (*MockMachine) Create added in v1.5.0

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

Create provides a mock function with given fields: driver, name, opts

func (*MockMachine) Credentials added in v1.5.0

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

Credentials provides a mock function with given fields: name

func (*MockMachine) Exist added in v1.5.0

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

Exist provides a mock function with given fields: name

func (*MockMachine) List added in v1.5.0

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

List provides a mock function with given fields:

func (*MockMachine) Provision added in v1.5.0

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

Provision provides a mock function with given fields: name

func (*MockMachine) Remove added in v1.5.0

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

Remove provides a mock function with given fields: name

func (*MockMachine) Stop

func (_m *MockMachine) Stop(name string, timeout time.Duration) error

Stop provides a mock function with given fields: name, timeout

Jump to

Keyboard shortcuts

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