containers

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package containers allows to interact with different container engines.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRuntime = errors.New("invalid runtime")

ErrInvalidRuntime means that the provided container runtime is not supported.

Functions

This section is empty.

Types

type DockerdClient

type DockerdClient struct {
	client.APIClient
	// contains filtered or unexported fields
}

DockerdClient represents a Docker API client.

func NewDockerdClient

func NewDockerdClient(rt Runtime) (DockerdClient, error)

NewDockerdClient returns a new container runtime client compatible with the Docker API. Depending on the runtime being used (see Runtime), there can be small differences. The provided runtime allows to fine-tune the behavior of the client. This client behaves as close as possible to the Docker CLI. It gets its configuration from the Docker config file and honors the Docker CLI environment variables. It also sets up TLS authentication if TLS is enabled.

func (*DockerdClient) Close

func (cli *DockerdClient) Close() error

Close closes the transport used by the client.

func (*DockerdClient) DaemonHost

func (cli *DockerdClient) DaemonHost() string

DaemonHost returns the host address used by the client.

func (*DockerdClient) HostGatewayHostname

func (cli *DockerdClient) HostGatewayHostname() string

HostGatewayHostname returns a hostname that points to the container engine host and is reachable from the containers.

func (*DockerdClient) HostGatewayInterfaceAddr

func (cli *DockerdClient) HostGatewayInterfaceAddr() (string, error)

HostGatewayInterfaceAddr returns the address of a local interface that is reachable from the containers.

func (*DockerdClient) HostGatewayMapping

func (cli *DockerdClient) HostGatewayMapping() string

HostGatewayMapping returns the host-to-IP mapping required by the containers to reach the container engine host. It returns an empty string if this mapping is not required.

type Runtime

type Runtime int

Runtime is the container runtime.

const (
	RuntimeDockerd               Runtime = iota // Docker Engine
	RuntimeDockerdDockerDesktop                 // Docker Desktop
	RuntimeDockerdRancherDesktop                // Rancher Desktop (dockerd)
	RuntimeDockerdPodmanDesktop                 // Podman Desktop (dockerd)
)

Container runtimes.

func GetenvRuntime

func GetenvRuntime() (Runtime, error)

GetenvRuntime gets the container runtime from the LAVA_RUNTIME environment variable.

func ParseRuntime

func ParseRuntime(s string) (Runtime, error)

ParseRuntime converts a runtime name into a Runtime value. It returns error if the provided name does not match any known container runtime.

func (*Runtime) UnmarshalText

func (rt *Runtime) UnmarshalText(text []byte) error

UnmarshalText decodes a runtime name into a Runtime value. It returns error if the provided name does not match any known container runtime.

Jump to

Keyboard shortcuts

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