dockerutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureImage

func EnsureImage(ctx context.Context, cli *client.Client, imageRef string) error

EnsureImage pulls imageRef when it is not already present on the daemon.

func Exec

func Exec(ctx context.Context, cli *client.Client, containerID string, cmd []string, stdin io.Reader) error

Exec runs cmd inside an existing container through the Docker SDK.

func NewClient

func NewClient(ctx context.Context, configuredHost string) (*client.Client, string, error)

NewClient resolves a reachable Docker-compatible daemon and returns a client configured for it.

func RunContainer

func RunContainer(
	ctx context.Context,
	cli *client.Client,
	cfg *container.Config,
	hostCfg *container.HostConfig,
	name string,
) error

RunContainer runs a short-lived helper container and removes it afterwards. On failure it includes captured container output in the returned error.

func RunContainerOnNetwork

func RunContainerOnNetwork(
	ctx context.Context,
	cli *client.Client,
	cfg *container.Config,
	hostCfg *container.HostConfig,
	netCfg *network.NetworkingConfig,
	name string,
) error

RunContainerOnNetwork is like RunContainer but attaches the container to a named Docker network via netCfg. Pass nil for netCfg to use the default bridge network (equivalent to RunContainer).

Types

This section is empty.

Jump to

Keyboard shortcuts

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