docker

package
v0.47.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KindContainerSuffix provides the string suffix that Kind names all cluster containers with.
	KindContainerSuffix = "-control-plane"

	// DefaultKindNetwork is the name of the default Docker network used for Kind clusters
	DefaultKindNetwork = "kind"
)

Functions

func GetDockerContainerIPNetwork

func GetDockerContainerIPNetwork(containerID, networkName string) (*net.IPNet, *net.IPNet, error)

GetDockerContainerIPNetwork supports retreiving the *net.IP4Net of a container specified by name (and a specified network name for the case of multiple networks).

func GetKindContainerID

func GetKindContainerID(clusterName string) string

GetKindContainerID produces the docker container ID for the given kind cluster by name.

func GetKindContainerIP added in v0.20.0

func GetKindContainerIP(clusterName string) (string, error)

GetContainerIP retrieves the IPv4 address of a Kind container given the cluster name.

func InspectDockerContainer

func InspectDockerContainer(containerID string) (*types.ContainerJSON, error)

InspectDockerContainer is a helper function that uses the local docker environment provides the full container spec for a container present in that environment by name.

func NewNegotiatedClientWithOpts added in v0.44.0

func NewNegotiatedClientWithOpts(ctx context.Context, opts ...client.Opt) (*client.Client, error)

NewNegotiatedClientWithOpts is a wrapper around docker.NewClientWithOpts that negotiates the API version with the server.

func ReadFileFromContainer added in v0.11.0

func ReadFileFromContainer(ctx context.Context, containerID string, path string) (*bytes.Buffer, error)

ReadFileFromContainer reads a specific file from a given container by ID.

func RunPrivilegedCommand added in v0.11.0

func RunPrivilegedCommand(ctx context.Context, containerID, command string, args ...string) error

RunPrivilegedCommand is a very basic and opinionated helper function which runs the given command and arguments on the given container (by ID) privileged.

func WriteFileToContainer added in v0.11.0

func WriteFileToContainer(ctx context.Context, containerID string, path string, mode int64, data []byte) error

WriteFileToContainer writes a specific file to the container given ID.

Types

This section is empty.

Jump to

Keyboard shortcuts

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