Documentation ¶
Index ¶
- Constants
- func GetDockerAuth(dockerConfig *DockerConfig, imageName string) (string, error)
- type DockerConfig
- type DockerConfigAuth
- type DockerRuntime
- func (d *DockerRuntime) Config() runtime.RuntimeConfig
- func (d *DockerRuntime) CreateContainer(ctx context.Context, node *types.NodeConfig) (string, error)
- func (d *DockerRuntime) CreateNet(ctx context.Context) (err error)
- func (d *DockerRuntime) DeleteContainer(ctx context.Context, cID string) error
- func (d *DockerRuntime) DeleteNet(ctx context.Context) (err error)
- func (d *DockerRuntime) Exec(ctx context.Context, cID string, execCmd *exec.ExecCmd) (*exec.ExecResult, error)
- func (d *DockerRuntime) ExecNotWait(_ context.Context, cID string, execCmd *exec.ExecCmd) error
- func (d *DockerRuntime) GetContainer(ctx context.Context, cID string) (*runtime.GenericContainer, error)
- func (d *DockerRuntime) GetContainerStatus(ctx context.Context, cID string) runtime.ContainerStatus
- func (d *DockerRuntime) GetHostsPath(ctx context.Context, cID string) (string, error)
- func (d *DockerRuntime) GetNSPath(ctx context.Context, cID string) (string, error)
- func (*DockerRuntime) GetName() string
- func (d *DockerRuntime) Init(opts ...runtime.RuntimeOption) error
- func (d *DockerRuntime) IsHealthy(ctx context.Context, cID string) (bool, error)
- func (d *DockerRuntime) ListContainers(ctx context.Context, gfilters []*types.GenericFilter) ([]runtime.GenericContainer, error)
- func (d *DockerRuntime) Mgmt() *types.MgmtNet
- func (d *DockerRuntime) PauseContainer(ctx context.Context, cID string) error
- func (d *DockerRuntime) PullImage(ctx context.Context, imageName string, pullpolicy types.PullPolicyValue) error
- func (d *DockerRuntime) StartContainer(ctx context.Context, cID string, node runtime.Node) (interface{}, error)
- func (d *DockerRuntime) StopContainer(ctx context.Context, name string) error
- func (d *DockerRuntime) UnpauseContainer(ctx context.Context, cID string) error
- func (d *DockerRuntime) WithConfig(cfg *runtime.RuntimeConfig)
- func (d *DockerRuntime) WithKeepMgmtNet()
- func (d *DockerRuntime) WithMgmtNet(n *types.MgmtNet)
Constants ¶
const (
RuntimeName = "docker"
)
Variables ¶
This section is empty.
Functions ¶
func GetDockerAuth ¶ added in v0.24.0
func GetDockerAuth(dockerConfig *DockerConfig, imageName string) (string, error)
GetDockerAuth extracts an auth string for the given container image name based on the credentials stored in docker daemon config file.
Types ¶
type DockerConfig ¶ added in v0.24.0
type DockerConfig struct {
Auths map[string]DockerConfigAuth `json:"auths,omitempty"`
}
DockerConfig represents the docker config that is typically contained within ~/.docker/config.json.
func GetDockerConfig ¶ added in v0.24.0
func GetDockerConfig(configPath string) (*DockerConfig, error)
GetDockerConfig reads the docker config file by the configPath and returns the DockerConfig struct with parts of the docker config.
type DockerConfigAuth ¶ added in v0.24.0
type DockerConfigAuth struct {
Auth string
}
type DockerRuntime ¶
func (*DockerRuntime) Config ¶ added in v0.15.0
func (d *DockerRuntime) Config() runtime.RuntimeConfig
func (*DockerRuntime) CreateContainer ¶
func (d *DockerRuntime) CreateContainer(ctx context.Context, node *types.NodeConfig) (string, error)
CreateContainer creates a docker container (but does not start it).
func (*DockerRuntime) CreateNet ¶
func (d *DockerRuntime) CreateNet(ctx context.Context) (err error)
CreateNet creates a docker network or reusing if it exists.
func (*DockerRuntime) DeleteContainer ¶
func (d *DockerRuntime) DeleteContainer(ctx context.Context, cID string) error
DeleteContainer tries to stop a container then remove it.
func (*DockerRuntime) DeleteNet ¶
func (d *DockerRuntime) DeleteNet(ctx context.Context) (err error)
DeleteNet deletes a docker bridge.
func (*DockerRuntime) Exec ¶
func (d *DockerRuntime) Exec(ctx context.Context, cID string, execCmd *exec.ExecCmd) (*exec.ExecResult, error)
Exec executes cmd on container identified with id and returns stdout, stderr bytes and an error.
func (*DockerRuntime) ExecNotWait ¶
ExecNotWait executes cmd on container identified with id but doesn't wait for output nor attaches stdout/err.
func (*DockerRuntime) GetContainer ¶ added in v0.15.0
func (d *DockerRuntime) GetContainer(ctx context.Context, cID string) (*runtime.GenericContainer, error)
func (*DockerRuntime) GetContainerStatus ¶ added in v0.32.0
func (d *DockerRuntime) GetContainerStatus(ctx context.Context, cID string) runtime.ContainerStatus
GetContainerStatus retrieves the ContainerStatus of the named container.
func (*DockerRuntime) GetHostsPath ¶ added in v0.27.0
GetHostsPath returns fs path to a file which is mounted as /etc/hosts into a given container.
func (*DockerRuntime) GetNSPath ¶
GetNSPath inspects a container by its name/id and returns a netns path using the pid of a container.
func (*DockerRuntime) GetName ¶ added in v0.15.0
func (*DockerRuntime) GetName() string
func (*DockerRuntime) Init ¶ added in v0.15.0
func (d *DockerRuntime) Init(opts ...runtime.RuntimeOption) error
func (*DockerRuntime) IsHealthy ¶ added in v0.51.0
IsHealthy returns true is the container is reported as being healthy, false otherwise.
func (*DockerRuntime) ListContainers ¶
func (d *DockerRuntime) ListContainers(ctx context.Context, gfilters []*types.GenericFilter) ([]runtime.GenericContainer, error)
ListContainers lists all containers using the provided filters.
func (*DockerRuntime) Mgmt ¶
func (d *DockerRuntime) Mgmt() *types.MgmtNet
Mgmt return management network struct of a runtime.
func (*DockerRuntime) PauseContainer ¶ added in v0.26.0
func (d *DockerRuntime) PauseContainer(ctx context.Context, cID string) error
PauseContainer Pauses a container identified by its name.
func (*DockerRuntime) PullImage ¶ added in v0.36.0
func (d *DockerRuntime) PullImage(ctx context.Context, imageName string, pullpolicy types.PullPolicyValue) error
PullImage pulls the container image using the provided image pull policy value.
func (*DockerRuntime) StartContainer ¶
func (d *DockerRuntime) StartContainer(ctx context.Context, cID string, node runtime.Node) (interface{}, error)
StartContainer starts a docker container.
func (*DockerRuntime) StopContainer ¶
func (d *DockerRuntime) StopContainer(ctx context.Context, name string) error
func (*DockerRuntime) UnpauseContainer ¶ added in v0.26.0
func (d *DockerRuntime) UnpauseContainer(ctx context.Context, cID string) error
UnpauseContainer UnPauses / resumes a container identified by its name.
func (*DockerRuntime) WithConfig ¶ added in v0.15.0
func (d *DockerRuntime) WithConfig(cfg *runtime.RuntimeConfig)
func (*DockerRuntime) WithKeepMgmtNet ¶ added in v0.15.0
func (d *DockerRuntime) WithKeepMgmtNet()
func (*DockerRuntime) WithMgmtNet ¶ added in v0.15.0
func (d *DockerRuntime) WithMgmtNet(n *types.MgmtNet)