docker

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeCommand

func ComposeCommand() []string

ComposeCommand returns the docker compose invocation (docker compose vs docker-compose).

func CopyFile added in v0.2.0

func CopyFile(src, dst string) error

CopyFile copies a single file from src to dst, preserving permissions.

func CopyNonEmptyContents added in v0.2.0

func CopyNonEmptyContents(src, dst string) error

CopyNonEmptyContents recursively copies only non-empty files and directories from a Docker container extraction, skipping system directories that Docker creates.

Types

type Executor

type Executor struct {
	Verbose bool
	WorkDir string
}

Executor wraps docker CLI operations with a working directory and verbosity.

func NewExecutor

func NewExecutor(verbose bool, workDir string) *Executor

NewExecutor returns a configured docker executor.

func (*Executor) Build

func (e *Executor) Build(imageName, context string, extraArgs ...string) error

Build runs docker build with the supplied tag, context, and additional args.

func (*Executor) CheckAvailability

func (e *Executor) CheckAvailability() error

CheckAvailability ensures docker CLI and daemon are reachable.

func (*Executor) CopyFromContainer added in v0.2.0

func (e *Executor) CopyFromContainer(containerID, containerPath, localPath string) error

CopyFromContainer copies files from a container path to a local path. TODO: Extend Run to support quiet mode so this can use e.Run.

func (*Executor) CreateContainer added in v0.2.0

func (e *Executor) CreateContainer(imageRef string) (string, error)

CreateContainer creates a container from an image without starting it and returns the container ID. It tries with an entrypoint override first, then falls back for minimal images without a shell. TODO: Extend Run to support capturing output so this can use e.Run.

func (*Executor) ImageExistsLocally added in v0.2.0

func (e *Executor) ImageExistsLocally(imageRef string) bool

ImageExistsLocally checks if an image exists in the local Docker cache. TODO: Extend Run to support quiet mode so this can use e.Run.

func (*Executor) Pull added in v0.2.0

func (e *Executor) Pull(imageRef string) error

Pull pulls a Docker image.

func (*Executor) Push

func (e *Executor) Push(imageName string) error

Push pushes the provided image to its registry.

func (*Executor) RemoveContainer added in v0.2.0

func (e *Executor) RemoveContainer(containerID string) error

RemoveContainer removes a container by ID. TODO: Extend Run to support quiet mode so this can use e.Run.

func (*Executor) Run

func (e *Executor) Run(args ...string) error

Run executes docker with the provided arguments.

Jump to

Keyboard shortcuts

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