docker

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package docker builds the DockerClient from config: the stub (the default) or the docker binary run through a CommandRunner (exec), run through the client tier (Decorate).

Index

Constants

View Source
const (
	// KindStub has no daemon (the default).
	KindStub client.Kind = "stub"

	// KindExec runs the docker binary.
	KindExec client.Kind = "exec"
)

Variables

This section is empty.

Functions

func Decorate

func Decorate(
	base interfaces.DockerClient,
	decs decorate.Decorations,
	name string,
	opts ...client.Option,
) (interfaces.DockerClient, error)

Decorate runs every DockerClient operation of base through the client tier as the client named name. Every operation converges when repeated (a build is cached, a push and a Compose up or down are idempotent), so each may retry.

func NewFromConfig

func NewFromConfig(
	ctx context.Context,
	cfg Config,
	deps Deps,
) (interfaces.DockerClient, error)

NewFromConfig builds the docker client cfg.Kind selects and runs it through the client tier. An unknown kind, or exec without a runner, is CodeInvalidInput.

Types

type Config

type Config struct {
	// Kind selects the backend; empty means KindStub.
	Kind client.Kind `yaml:"kind" mapstructure:"kind"`

	// Name labels the client in decoration overrides, metrics, spans and logs; empty
	// uses the family name ("docker").
	Name string `yaml:"name" mapstructure:"name"`
}

Config selects the docker client.

type Deps

type Deps struct {
	// Decorations decorates the client and supplies its observability.
	decorate.Decorations

	// Runner runs docker for KindExec.
	Runner interfaces.CommandRunner

	// Root is the directory docker runs in; build contexts and Compose files are
	// relative to it.
	Root string
}

Deps carries the docker client's collaborators.

Directories

Path Synopsis
Package exec is the DockerClient that runs the docker binary through a CommandRunner.
Package exec is the DockerClient that runs the docker binary through a CommandRunner.
Package stub is the DockerClient with no daemon: builds, pushes and stacks succeed without effect, and no image exists.
Package stub is the DockerClient with no daemon: builds, pushes and stacks succeed without effect, and no image exists.

Jump to

Keyboard shortcuts

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