Documentation ¶
Overview ¶
Package containers allows to interact with different container engines.
Index ¶
- Variables
- type DockerdClient
- func (cli *DockerdClient) Close() error
- func (cli *DockerdClient) DaemonHost() string
- func (cli *DockerdClient) HostGatewayHostname() string
- func (cli *DockerdClient) HostGatewayInterfaceAddr() (string, error)
- func (cli *DockerdClient) HostGatewayMapping() string
- func (cli *DockerdClient) ImageBuild(ctx context.Context, path, dockerfile, ref string) (id string, err error)
- type Runtime
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRuntime = errors.New("invalid runtime")
ErrInvalidRuntime means that the provided container runtime is not supported.
Functions ¶
This section is empty.
Types ¶
type DockerdClient ¶
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.
func (*DockerdClient) ImageBuild ¶ added in v0.7.0
func (cli *DockerdClient) ImageBuild(ctx context.Context, path, dockerfile, ref string) (id string, err error)
ImageBuild builds a Docker image in the context of a path using the provided dockerfile and assigns it the specified reference. It returns the ID of the new image.
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 ¶
GetenvRuntime gets the container runtime from the LAVA_RUNTIME environment variable.
func ParseRuntime ¶
ParseRuntime converts a runtime name into a Runtime value. It returns error if the provided name does not match any known container runtime.