Documentation ¶
Overview ¶
Package docker aims to provide simple "helper" methods to ease the use of docker in (integration) tests.
It does support a subset of options compared to actual client api, as it is more focused on needs for integration tests.
Index ¶
- Constants
- Variables
- type APIClient
- type ContainerConfig
- type Project
- func (p *Project) Clean(keep bool) error
- func (p *Project) Create(image string) (types.ContainerJSON, error)
- func (p *Project) CreateWithConfig(image string, containerConfig ContainerConfig) (types.ContainerJSON, error)
- func (p *Project) Inspect(containerID string) (types.ContainerJSON, error)
- func (p *Project) IsPaused(containerID string) (bool, error)
- func (p *Project) IsRunning(containerID string) (bool, error)
- func (p *Project) IsStopped(containerID string) (bool, error)
- func (p *Project) List() ([]types.Container, error)
- func (p *Project) Pull(ref string) error
- func (p *Project) Remove(containerID string) error
- func (p *Project) Start(image string) (types.ContainerJSON, error)
- func (p *Project) StartWithConfig(image string, containerConfig ContainerConfig) (types.ContainerJSON, error)
- func (p *Project) Stop(containerID string) error
- func (p *Project) StopWithTimeout(containerID string, timeout int) error
Constants ¶
const (
// KermitLabel is the label used to add to containers
KermitLabel = "com.github.vdemeester.libkermit"
)
Variables ¶
var ( // KermitHeader defines default kermit headers to pass through the API KermitHeader = map[string]string{ "User-Agent": "libkermit-1.0", } // KermitLabels defines default docker labels kermit will but on // containers and such. KermitLabels = map[string]string{ KermitLabel: "true", } // KermitLabelFilter is the filter to use to find containers managed by kermit KermitLabelFilter = fmt.Sprintf("label=%s", KermitLabel) // DefaultStopTimeout is the default timeout for the stop command DefaultStopTimeout = 10 // CurrentAPIVersion defines the current "lower" docker API version // supported by libkermit. CurrentAPIVersion = "v1.21" )
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient interface { client.ContainerAPIClient client.ImageAPIClient }
APIClient is a lightweight representation of docker client.APIClient
type ContainerConfig ¶
type ContainerConfig struct { Name string Cmd []string Entrypoint []string Labels map[string]string }
ContainerConfig holds container libkermit configuration possibilities
type Project ¶
Project holds docker related project attributes, like docker client, labels to put on the containers, and so on.
func NewProject ¶
NewProject creates a project with the given client and the default attributes.
func NewProjectFromEnv ¶
NewProjectFromEnv creates a project with a client that is build from environment variables.
func (*Project) Clean ¶
Clean stops and removes (by default, controllable with the keep) kermit containers
func (*Project) Create ¶
func (p *Project) Create(image string) (types.ContainerJSON, error)
Create lets you create a container with the specified image, and default configuration.
func (*Project) CreateWithConfig ¶
func (p *Project) CreateWithConfig(image string, containerConfig ContainerConfig) (types.ContainerJSON, error)
CreateWithConfig lets you create a container with the specified image, and some custom simple configuration.
func (*Project) Inspect ¶
func (p *Project) Inspect(containerID string) (types.ContainerJSON, error)
Inspect returns the container informations
func (*Project) Start ¶
func (p *Project) Start(image string) (types.ContainerJSON, error)
Start lets you create and start a container with the specified image, and default configuration.
func (*Project) StartWithConfig ¶
func (p *Project) StartWithConfig(image string, containerConfig ContainerConfig) (types.ContainerJSON, error)
StartWithConfig lets you create and start a container with the specified image, and some custom simple configuration.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package testing aims to provide simple "helper" methods to ease the use of docker in (integration) tests using the testing built-in package.
|
Package testing aims to provide simple "helper" methods to ease the use of docker in (integration) tests using the testing built-in package. |