docker

package
v0.48.5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
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)

type DockerConfigAuth added in v0.24.0

type DockerConfigAuth struct {
	Auth string
}

type DockerRuntime

type DockerRuntime struct {
	Client *dockerC.Client
	// contains filtered or unexported fields
}

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

func (d *DockerRuntime) ExecNotWait(_ context.Context, cID string, execCmd *exec.ExecCmd) error

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

func (d *DockerRuntime) GetHostsPath(ctx context.Context, cID string) (string, error)

GetHostsPath returns fs path to a file which is mounted as /etc/hosts into a given container.

func (*DockerRuntime) GetNSPath

func (d *DockerRuntime) GetNSPath(ctx context.Context, cID string) (string, error)

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) 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)

Jump to

Keyboard shortcuts

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