Documentation ¶
Overview ¶
Package container contains utilities for building image from services.
Package container is a generated GoMock package.
Index ¶
- Variables
- type Container
- type ContainerRuntime
- func (cr *ContainerRuntime) AddToNetwork(n *Network, con *Container) error
- func (cr *ContainerRuntime) AllContainers() ([]*Container, error)
- func (cr *ContainerRuntime) BuildImage(img *Image) error
- func (cr *ContainerRuntime) Context() context.Context
- func (cr *ContainerRuntime) CreateNetwork(net *Network) error
- func (cr *ContainerRuntime) GetContainer(name string) (*Container, error)
- func (cr *ContainerRuntime) GetImage(name string) (*Image, error)
- func (cr *ContainerRuntime) ListImages() ([]*Image, error)
- func (cr *ContainerRuntime) NetworkExists(net *Network) (bool, error)
- func (cr *ContainerRuntime) NewContainer(name string, image Image, mounts ...Mount) *Container
- func (cr *ContainerRuntime) NewNetwork(name string) *Network
- func (cr *ContainerRuntime) PullImage(name string) (*Image, error)
- func (cr *ContainerRuntime) RemoveContainer(con *Container) error
- func (cr *ContainerRuntime) RemoveFromNetwork(net *Network, con *Container) error
- func (cr *ContainerRuntime) RemoveNetwork(net *Network) error
- func (cr *ContainerRuntime) RunContainer(net *Network, con *Container) error
- func (cr *ContainerRuntime) StopContainer(con *Container) error
- type DockerClient
- type Image
- type MockDockerClient
- func (m *MockDockerClient) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.ContainerCreateCreatedBody, error)
- func (m *MockDockerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
- func (m *MockDockerClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
- func (m *MockDockerClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
- func (m *MockDockerClient) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
- func (m *MockDockerClient) EXPECT() *MockDockerClientMockRecorder
- func (m *MockDockerClient) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
- func (m *MockDockerClient) ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)
- func (m *MockDockerClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
- func (m *MockDockerClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
- func (m *MockDockerClient) NetworkConnect(ctx context.Context, networkID, containerID string, ...) error
- func (m *MockDockerClient) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
- func (m *MockDockerClient) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
- func (m *MockDockerClient) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
- func (m *MockDockerClient) NetworkRemove(ctx context.Context, networkID string) error
- type MockDockerClientMockRecorder
- func (mr *MockDockerClientMockRecorder) ContainerCreate(ctx, config, hostConfig, networkingConfig, platform, containerName interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerList(ctx, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerRemove(ctx, containerID, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerStart(ctx, containerID, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerStop(ctx, containerID, timeout interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ImageBuild(ctx, buildContext, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ImageInspectWithRaw(ctx, imageID interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ImageList(ctx, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ImagePull(ctx, ref, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) NetworkConnect(ctx, networkID, containerID, config interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) NetworkCreate(ctx, name, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) NetworkDisconnect(ctx, networkID, containerID, force interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) NetworkList(ctx, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) NetworkRemove(ctx, networkID interface{}) *gomock.Call
- type Mount
- type Network
Constants ¶
This section is empty.
Variables ¶
var ( FailedToListImages = errors.New("failed to list images") FailedToBuildImage = errors.New("failed to build the image") FailedToPullImage = errors.New("failed to pull the image") FailedToInspectImage = errors.New("failed to inspect the image") )
var ( DockerEngineError = errors.New("failed to connect to docker engine") FailedToConnectToDockerEngineError = errors.New("failed to connect to docker engine") FailedToPrepareBuildArchive = errors.New("failed to prepare the build archive") FailedToCreateContainer = errors.New("failed to create the container") FailedToStartContainer = errors.New("failed to start the container") FailedToStopContainer = errors.New("failed to stop the container") FailedToRemoveContainer = errors.New("failed to remove the container") FailedToBindVolume = errors.New("failed to bind container volume") )
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct { ID string Name string NetworkAlias string Image Image Ports []int Mounts []Mount Environment map[string]string }
A very simple struct for representing the functionality we actually need to expose from here.
type ContainerRuntime ¶
type ContainerRuntime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func (*ContainerRuntime) AddToNetwork ¶
func (cr *ContainerRuntime) AddToNetwork(n *Network, con *Container) error
func (*ContainerRuntime) AllContainers ¶
func (cr *ContainerRuntime) AllContainers() ([]*Container, error)
func (*ContainerRuntime) BuildImage ¶
func (cr *ContainerRuntime) BuildImage(img *Image) error
func (*ContainerRuntime) Context ¶
func (cr *ContainerRuntime) Context() context.Context
func (*ContainerRuntime) CreateNetwork ¶
func (cr *ContainerRuntime) CreateNetwork(net *Network) error
func (*ContainerRuntime) GetContainer ¶
func (cr *ContainerRuntime) GetContainer(name string) (*Container, error)
func (*ContainerRuntime) GetImage ¶
func (cr *ContainerRuntime) GetImage(name string) (*Image, error)
func (*ContainerRuntime) ListImages ¶
func (cr *ContainerRuntime) ListImages() ([]*Image, error)
func (*ContainerRuntime) NetworkExists ¶
func (cr *ContainerRuntime) NetworkExists(net *Network) (bool, error)
func (*ContainerRuntime) NewContainer ¶
func (cr *ContainerRuntime) NewContainer( name string, image Image, mounts ...Mount, ) *Container
func (*ContainerRuntime) NewNetwork ¶
func (cr *ContainerRuntime) NewNetwork(name string) *Network
func (*ContainerRuntime) PullImage ¶
func (cr *ContainerRuntime) PullImage(name string) (*Image, error)
func (*ContainerRuntime) RemoveContainer ¶
func (cr *ContainerRuntime) RemoveContainer(con *Container) error
func (*ContainerRuntime) RemoveFromNetwork ¶
func (cr *ContainerRuntime) RemoveFromNetwork(net *Network, con *Container) error
func (*ContainerRuntime) RemoveNetwork ¶
func (cr *ContainerRuntime) RemoveNetwork(net *Network) error
func (*ContainerRuntime) RunContainer ¶
func (cr *ContainerRuntime) RunContainer(net *Network, con *Container) error
func (*ContainerRuntime) StopContainer ¶
func (cr *ContainerRuntime) StopContainer(con *Container) error
type DockerClient ¶
type DockerClient interface { ImagePull( ctx context.Context, ref string, options types.ImagePullOptions, ) (io.ReadCloser, error) ImageList( ctx context.Context, options types.ImageListOptions, ) ([]types.ImageSummary, error) ImageBuild( ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions, ) (types.ImageBuildResponse, error) ImageInspectWithRaw( ctx context.Context, imageID string, ) (types.ImageInspect, []byte, error) NetworkCreate( ctx context.Context, name string, options types.NetworkCreate, ) (types.NetworkCreateResponse, error) NetworkRemove( ctx context.Context, networkID string, ) error NetworkList( ctx context.Context, options types.NetworkListOptions, ) ([]types.NetworkResource, error) NetworkConnect( ctx context.Context, networkID, containerID string, config *network.EndpointSettings, ) error NetworkDisconnect( ctx context.Context, networkID, containerID string, force bool, ) error ContainerCreate( ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string, ) (container.ContainerCreateCreatedBody, error) ContainerStart( ctx context.Context, containerID string, options types.ContainerStartOptions, ) error ContainerStop( ctx context.Context, containerID string, timeout *time.Duration, ) error ContainerRemove( ctx context.Context, containerID string, options types.ContainerRemoveOptions, ) error ContainerList( ctx context.Context, options types.ContainerListOptions, ) ([]types.Container, error) }
type MockDockerClient ¶
type MockDockerClient struct {
// contains filtered or unexported fields
}
MockDockerClient is a mock of DockerClient interface
func NewMockDockerClient ¶
func NewMockDockerClient(ctrl *gomock.Controller) *MockDockerClient
NewMockDockerClient creates a new mock instance
func (*MockDockerClient) ContainerCreate ¶
func (m *MockDockerClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *v1.Platform, containerName string) (container.ContainerCreateCreatedBody, error)
ContainerCreate mocks base method
func (*MockDockerClient) ContainerList ¶
func (m *MockDockerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
ContainerList mocks base method
func (*MockDockerClient) ContainerRemove ¶
func (m *MockDockerClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
ContainerRemove mocks base method
func (*MockDockerClient) ContainerStart ¶
func (m *MockDockerClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
ContainerStart mocks base method
func (*MockDockerClient) ContainerStop ¶
func (m *MockDockerClient) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
ContainerStop mocks base method
func (*MockDockerClient) EXPECT ¶
func (m *MockDockerClient) EXPECT() *MockDockerClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockDockerClient) ImageBuild ¶
func (m *MockDockerClient) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
ImageBuild mocks base method
func (*MockDockerClient) ImageInspectWithRaw ¶
func (m *MockDockerClient) ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)
ImageInspectWithRaw mocks base method
func (*MockDockerClient) ImageList ¶
func (m *MockDockerClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
ImageList mocks base method
func (*MockDockerClient) ImagePull ¶
func (m *MockDockerClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
ImagePull mocks base method
func (*MockDockerClient) NetworkConnect ¶
func (m *MockDockerClient) NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error
NetworkConnect mocks base method
func (*MockDockerClient) NetworkCreate ¶
func (m *MockDockerClient) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
NetworkCreate mocks base method
func (*MockDockerClient) NetworkDisconnect ¶
func (m *MockDockerClient) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
NetworkDisconnect mocks base method
func (*MockDockerClient) NetworkList ¶
func (m *MockDockerClient) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
NetworkList mocks base method
func (*MockDockerClient) NetworkRemove ¶
func (m *MockDockerClient) NetworkRemove(ctx context.Context, networkID string) error
NetworkRemove mocks base method
type MockDockerClientMockRecorder ¶
type MockDockerClientMockRecorder struct {
// contains filtered or unexported fields
}
MockDockerClientMockRecorder is the mock recorder for MockDockerClient
func (*MockDockerClientMockRecorder) ContainerCreate ¶
func (mr *MockDockerClientMockRecorder) ContainerCreate(ctx, config, hostConfig, networkingConfig, platform, containerName interface{}) *gomock.Call
ContainerCreate indicates an expected call of ContainerCreate
func (*MockDockerClientMockRecorder) ContainerList ¶
func (mr *MockDockerClientMockRecorder) ContainerList(ctx, options interface{}) *gomock.Call
ContainerList indicates an expected call of ContainerList
func (*MockDockerClientMockRecorder) ContainerRemove ¶
func (mr *MockDockerClientMockRecorder) ContainerRemove(ctx, containerID, options interface{}) *gomock.Call
ContainerRemove indicates an expected call of ContainerRemove
func (*MockDockerClientMockRecorder) ContainerStart ¶
func (mr *MockDockerClientMockRecorder) ContainerStart(ctx, containerID, options interface{}) *gomock.Call
ContainerStart indicates an expected call of ContainerStart
func (*MockDockerClientMockRecorder) ContainerStop ¶
func (mr *MockDockerClientMockRecorder) ContainerStop(ctx, containerID, timeout interface{}) *gomock.Call
ContainerStop indicates an expected call of ContainerStop
func (*MockDockerClientMockRecorder) ImageBuild ¶
func (mr *MockDockerClientMockRecorder) ImageBuild(ctx, buildContext, options interface{}) *gomock.Call
ImageBuild indicates an expected call of ImageBuild
func (*MockDockerClientMockRecorder) ImageInspectWithRaw ¶
func (mr *MockDockerClientMockRecorder) ImageInspectWithRaw(ctx, imageID interface{}) *gomock.Call
ImageInspectWithRaw indicates an expected call of ImageInspectWithRaw
func (*MockDockerClientMockRecorder) ImageList ¶
func (mr *MockDockerClientMockRecorder) ImageList(ctx, options interface{}) *gomock.Call
ImageList indicates an expected call of ImageList
func (*MockDockerClientMockRecorder) ImagePull ¶
func (mr *MockDockerClientMockRecorder) ImagePull(ctx, ref, options interface{}) *gomock.Call
ImagePull indicates an expected call of ImagePull
func (*MockDockerClientMockRecorder) NetworkConnect ¶
func (mr *MockDockerClientMockRecorder) NetworkConnect(ctx, networkID, containerID, config interface{}) *gomock.Call
NetworkConnect indicates an expected call of NetworkConnect
func (*MockDockerClientMockRecorder) NetworkCreate ¶
func (mr *MockDockerClientMockRecorder) NetworkCreate(ctx, name, options interface{}) *gomock.Call
NetworkCreate indicates an expected call of NetworkCreate
func (*MockDockerClientMockRecorder) NetworkDisconnect ¶
func (mr *MockDockerClientMockRecorder) NetworkDisconnect(ctx, networkID, containerID, force interface{}) *gomock.Call
NetworkDisconnect indicates an expected call of NetworkDisconnect
func (*MockDockerClientMockRecorder) NetworkList ¶
func (mr *MockDockerClientMockRecorder) NetworkList(ctx, options interface{}) *gomock.Call
NetworkList indicates an expected call of NetworkList
func (*MockDockerClientMockRecorder) NetworkRemove ¶
func (mr *MockDockerClientMockRecorder) NetworkRemove(ctx, networkID interface{}) *gomock.Call
NetworkRemove indicates an expected call of NetworkRemove