docker

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Overview

Package docker implements runtime.Interface and runtime.Config interfaces by talking to Docker API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string `json:"host,omitempty"`
}

Config struct represents Docker container runtime configuration.

func DefaultConfig added in v0.2.0

func DefaultConfig() *Config

DefaultConfig returns Docker's runtime default configuration.

func (*Config) GetAddress

func (c *Config) GetAddress() string

GetAddress returns configured container runtime address.

func (*Config) New

func (c *Config) New() (runtime.Runtime, error)

New validates Docker runtime configuration and returns configured runtime client.

func (*Config) SetAddress

func (c *Config) SetAddress(s string)

SetAddress sets runtime config address where it should connect.

type FakeClient added in v0.2.0

type FakeClient struct {
	ContainerCreateF   func(ctx context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, containerName string) (containertypes.ContainerCreateCreatedBody, error)
	ContainerStartF    func(ctx context.Context, container string, options dockertypes.ContainerStartOptions) error
	ContainerStopF     func(ctx context.Context, container string, timeout *time.Duration) error
	ContainerInspectF  func(ctx context.Context, container string) (dockertypes.ContainerJSON, error)
	ContainerRemoveF   func(ctx context.Context, container string, options dockertypes.ContainerRemoveOptions) error
	CopyFromContainerF func(ctx context.Context, container, srcPath string) (io.ReadCloser, dockertypes.ContainerPathStat, error)
	CopyToContainerF   func(ctx context.Context, container, path string, content io.Reader, options dockertypes.CopyToContainerOptions) error
	ContainerStatPathF func(ctx context.Context, container, path string) (dockertypes.ContainerPathStat, error)
	ImageListF         func(ctx context.Context, options dockertypes.ImageListOptions) ([]dockertypes.ImageSummary, error)
	ImagePullF         func(ctx context.Context, ref string, options dockertypes.ImagePullOptions) (io.ReadCloser, error)
}

FakeClient is a mock of Docker client.

func (*FakeClient) ContainerCreate added in v0.2.0

func (f *FakeClient) ContainerCreate(ctx context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, containerName string) (containertypes.ContainerCreateCreatedBody, error)

ContainerCreate mocks Docker client ContainerCreate().

func (*FakeClient) ContainerInspect added in v0.2.0

func (f *FakeClient) ContainerInspect(ctx context.Context, container string) (dockertypes.ContainerJSON, error)

ContainerInspect mocks Docker client ContainerInspect().

func (*FakeClient) ContainerRemove added in v0.2.0

func (f *FakeClient) ContainerRemove(ctx context.Context, container string, options dockertypes.ContainerRemoveOptions) error

ContainerRemove mocks Docker client ContainerRemove().

func (*FakeClient) ContainerStart added in v0.2.0

func (f *FakeClient) ContainerStart(ctx context.Context, container string, options dockertypes.ContainerStartOptions) error

ContainerStart mocks Docker client ContainerStart().

func (*FakeClient) ContainerStatPath added in v0.2.0

func (f *FakeClient) ContainerStatPath(ctx context.Context, container, path string) (dockertypes.ContainerPathStat, error)

ContainerStatPath mocks Docker client ContainerStatPath().

func (*FakeClient) ContainerStop added in v0.2.0

func (f *FakeClient) ContainerStop(ctx context.Context, container string, timeout *time.Duration) error

ContainerStop mocks Docker client ContainerStop().

func (*FakeClient) CopyFromContainer added in v0.2.0

func (f *FakeClient) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, dockertypes.ContainerPathStat, error)

CopyFromContainer mocks Docker client CopyFromContainer().

func (*FakeClient) CopyToContainer added in v0.2.0

func (f *FakeClient) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options dockertypes.CopyToContainerOptions) error

CopyToContainer mocks Docker client CopyToContainer().

func (*FakeClient) ImageList added in v0.2.0

ImageList mocks Docker client ImageList().

func (*FakeClient) ImagePull added in v0.2.0

func (f *FakeClient) ImagePull(ctx context.Context, ref string, options dockertypes.ImagePullOptions) (io.ReadCloser, error)

ImagePull mocks Docker client ImagePull().

Jump to

Keyboard shortcuts

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