Documentation ¶
Index ¶
- Variables
- type Builder
- func (builder *Builder) AddEnv(key string, value string) *Builder
- func (builder *Builder) AddLabel(key string, value string) *Builder
- func (builder *Builder) Env(env map[string]string) *Builder
- func (builder *Builder) Labels(labels map[string]string) *Builder
- func (builder *Builder) Memory(limit int64) *Builder
- func (builder *Builder) Mount(source string, dest string) *Builder
- func (builder *Builder) Mounts(mounts map[string]string) *Builder
- func (builder *Builder) Network(networkName string, aliasses ...string) *Builder
- func (builder *Builder) Port(port string) *Builder
- func (builder *Builder) Ports(ports []string) *Builder
- func (builder *Builder) Pull() *Builder
- func (builder *Builder) Start(ctx context.Context) (string, error)
- func (builder *Builder) WaitForHealthy() *Builder
- func (builder *Builder) WithName(containerName string) *Builder
- type Client
- func (client *Client) Close() error
- func (client *Client) ContainerListByLabels(ctx context.Context, all bool, containerLabels map[string]string) ([]types.Container, error)
- func (client *Client) ContainerListByNames(ctx context.Context, all bool, containerNames ...string) ([]types.Container, error)
- func (client *Client) ContainerRemoveByIDs(ctx context.Context, containerIDs ...string) error
- func (client *Client) ContainerRemoveByLabels(ctx context.Context, containerLabels map[string]string) error
- func (client *Client) ContainerRemoveByNames(ctx context.Context, containerNames ...string) error
- func (client *Client) ContainerStopByIDs(ctx context.Context, timeout time.Duration, containerIDs ...string) error
- func (client *Client) ContainerStopByLabels(ctx context.Context, timeout time.Duration, containerLabels map[string]string) error
- func (client *Client) ContainerStopByNames(ctx context.Context, timeout time.Duration, containerNames ...string) error
- func (client *Client) GetWatcher() *Watcher
- func (client *Client) NetworkListByLabels(ctx context.Context, networkLabels map[string]string) ([]types.NetworkResource, error)
- func (client *Client) NetworkListByNames(ctx context.Context, networkNames ...string) ([]types.NetworkResource, error)
- func (client *Client) NetworkRemoveByIDs(ctx context.Context, containerIDs ...string) error
- func (client *Client) NetworkRemoveByLabels(ctx context.Context, containerLabels map[string]string) error
- func (client *Client) NetworkRemoveByNames(ctx context.Context, networkNames ...string) error
- func (client *Client) NewBuilder(image string) *Builder
- func (client *Client) Pull(ctx context.Context, image string, w io.Writer) error
- func (client *Client) PullQuiet(ctx context.Context, image string) error
- func (client *Client) VolumeListByLabels(ctx context.Context, volumeLabels map[string]string) (volume.VolumeListOKBody, error)
- func (client *Client) VolumeListByNames(ctx context.Context, volumeNames ...string) (volume.VolumeListOKBody, error)
- func (client *Client) VolumeRemoveByLabels(ctx context.Context, volumeLabels map[string]string) error
- func (client *Client) VolumeRemoveByNames(ctx context.Context, volumeNames ...string) error
- type ErrorMapper
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var ( ErrDied = errors.New("died") ErrUnhealthy = errors.New("went unhealthy") )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a wrapper around the official docker API to start a container image.
func (*Builder) Mounts ¶
Mounts a set of source volumes or hostpath into the filesystem of the container
func (*Builder) Port ¶
Port defines a port forwarding from the host machine to the container Examples: - 8080:8080 - 10.6.231.10:8080:8080 - 10.6.231.10:8080:8080/tcp
func (*Builder) Ports ¶
Ports defines a set port forwarding rules from the host machine to the container Examples: - 8080:8080 - 10.6.231.10:8080:8080 - 10.6.231.10:8080:8080/tcp
func (*Builder) WaitForHealthy ¶
WaitForHealthy set the option to wait during the start process until the container is healthy.
type Client ¶
Client from the docker API with additional functions
func (*Client) ContainerListByLabels ¶
func (client *Client) ContainerListByLabels(ctx context.Context, all bool, containerLabels map[string]string) ([]types.Container, error)
ContainerListByLabels returns only containers which match by given labels
func (*Client) ContainerListByNames ¶
func (client *Client) ContainerListByNames(ctx context.Context, all bool, containerNames ...string) ([]types.Container, error)
ContainerListByNames returns only containers which match by given labels
func (*Client) ContainerRemoveByIDs ¶
ContainerRemoveByIDs deletes all containers which match by their container ids
func (*Client) ContainerRemoveByLabels ¶
func (client *Client) ContainerRemoveByLabels(ctx context.Context, containerLabels map[string]string) error
ContainerRemoveByLabels deletes all containers which match by given labels
func (*Client) ContainerRemoveByNames ¶
ContainerRemoveByNames deletes all containers which match by their names
func (*Client) ContainerStopByIDs ¶
func (client *Client) ContainerStopByIDs(ctx context.Context, timeout time.Duration, containerIDs ...string) error
ContainerStopByIDs deletes all containers which match by their container ids
func (*Client) ContainerStopByLabels ¶
func (client *Client) ContainerStopByLabels(ctx context.Context, timeout time.Duration, containerLabels map[string]string) error
ContainerStopByLabels shutdown containters which match by given labels
func (*Client) ContainerStopByNames ¶
func (client *Client) ContainerStopByNames(ctx context.Context, timeout time.Duration, containerNames ...string) error
ContainerStopByNames shutdown containters matching by their names
func (*Client) GetWatcher ¶
GetWatcher returns a watcher for container health states
func (*Client) NetworkListByLabels ¶
func (client *Client) NetworkListByLabels(ctx context.Context, networkLabels map[string]string) ([]types.NetworkResource, error)
NetworkListByLabels returns networks which match by given labels
func (*Client) NetworkListByNames ¶
func (client *Client) NetworkListByNames(ctx context.Context, networkNames ...string) ([]types.NetworkResource, error)
NetworkListByNames returns networks which match by their names. If a network can not be found, the function returns an error
func (*Client) NetworkRemoveByIDs ¶
NetworkRemoveByIDs remove all networks match by their id
func (*Client) NetworkRemoveByLabels ¶
func (client *Client) NetworkRemoveByLabels(ctx context.Context, containerLabels map[string]string) error
NetworkRemoveByLabels remove all networks which match by given labels
func (*Client) NetworkRemoveByNames ¶
NetworkRemoveByNames remove all networks match by their names. If a network can not be found, the function returns an error
func (*Client) NewBuilder ¶
NewBuilder returns a new builder for containers
func (*Client) VolumeListByLabels ¶
func (client *Client) VolumeListByLabels(ctx context.Context, volumeLabels map[string]string) (volume.VolumeListOKBody, error)
VolumeListByLabels returns volumes which match by given labels
func (*Client) VolumeListByNames ¶
func (client *Client) VolumeListByNames(ctx context.Context, volumeNames ...string) (volume.VolumeListOKBody, error)
VolumeListByNames returns volumes which match by their names. If a volume can not be found, the function returns an error
type ErrorMapper ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is a helper to listen on docker API events to notify if a container is healthy or not.
func (*Watcher) AddListener ¶
func (*Watcher) AddListenerWithErrorMapper ¶
func (watcher *Watcher) AddListenerWithErrorMapper(containerID string, errorChannel chan<- error, doneChannel chan<- struct{}, errorMapper ErrorMapper) error