Docker.Config (docker_wrapper v0.1.2)

Copy Markdown View Source

Configuration for the Docker CLI wrapper.

Holds the path to the Docker binary, working directory, environment variables, and timeout settings used when executing Docker commands.

Summary

Functions

Returns base arguments prepended to all Docker commands.

Builds the options keyword list for System.cmd/3.

Finds the Docker-compatible binary on the system.

Creates a new Docker.Config struct.

Types

t()

@type t() :: %Docker.Config{
  binary: String.t(),
  env: [{String.t(), String.t()}],
  timeout: pos_integer(),
  working_dir: String.t() | nil
}

Functions

base_args(config)

@spec base_args(t()) :: [String.t()]

Returns base arguments prepended to all Docker commands.

cmd_opts(config)

@spec cmd_opts(t()) :: keyword()

Builds the options keyword list for System.cmd/3.

find_binary()

@spec find_binary() :: String.t()

Finds the Docker-compatible binary on the system.

Checks the DOCKER_PATH environment variable first, then searches for docker, podman, or nerdctl on the PATH.

Raises if no binary is found.

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new Docker.Config struct.

Options

  • :binary - path to the Docker executable (default: auto-detected)
  • :working_dir - working directory for commands (default: nil, uses current directory)
  • :env - list of {key, value} tuples for environment variables (default: [])
  • :timeout - command timeout in milliseconds (default: 30000)

Examples

iex> config = Docker.Config.new()
iex> config.binary != nil
true

iex> config = Docker.Config.new(timeout: 60_000)
iex> config.timeout
60_000