docker

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

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)

CreateDockerNet 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, cmd []string) ([]byte, []byte, 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, cmd []string) 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) (*types.GenericContainer, error)

func (*DockerRuntime) GetNSPath

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

GetNSPath inspects a container by its name/id and returns an 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) ([]types.GenericContainer, error)

ListContainers lists all containers with labels []string

func (*DockerRuntime) Mgmt

func (d *DockerRuntime) Mgmt() *types.MgmtNet

Mgmt return management network struct of a runtime

func (*DockerRuntime) PullImageIfRequired

func (d *DockerRuntime) PullImageIfRequired(ctx context.Context, imageName string) error

func (*DockerRuntime) StartContainer

func (d *DockerRuntime) StartContainer(ctx context.Context, cID string, node *types.NodeConfig) (interface{}, error)

StartContainer starts a docker container

func (*DockerRuntime) StopContainer

func (d *DockerRuntime) StopContainer(ctx context.Context, name string) error

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