Docker.Debug.Retry (docker_wrapper v0.1.2)

Copy Markdown View Source

Retry policy for Docker command execution.

Configures how many times to retry a failed command, the backoff strategy between attempts, and which errors are retryable.

Examples

# Exponential backoff, 3 attempts
policy = Docker.Debug.Retry.new()

# Custom policy
policy = Docker.Debug.Retry.new(
  max_attempts: 5,
  backoff: :linear,
  base_delay: 1_000,
  max_delay: 30_000
)

Summary

Functions

Default retryable check. Retries on connection-related errors, not on validation or command errors.

Calculates the delay for a given attempt number (0-based).

Creates a new retry policy.

Types

backoff()

@type backoff() :: :exponential | :linear | :constant

retryable_fun()

@type retryable_fun() :: (term() -> boolean())

t()

@type t() :: %Docker.Debug.Retry{
  backoff: backoff(),
  base_delay: pos_integer(),
  max_attempts: pos_integer(),
  max_delay: pos_integer(),
  retryable?: retryable_fun()
}

Functions

default_retryable?(arg1)

@spec default_retryable?(term()) :: boolean()

Default retryable check. Retries on connection-related errors, not on validation or command errors.

delay(policy, attempt)

@spec delay(t(), non_neg_integer()) :: non_neg_integer()

Calculates the delay for a given attempt number (0-based).

new(opts \\ [])

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

Creates a new retry policy.

Options

  • :max_attempts - total attempts including the first (default: 3)
  • :backoff - :exponential, :linear, or :constant (default: :exponential)
  • :base_delay - starting delay in ms (default: 500)
  • :max_delay - maximum delay cap in ms (default: 10_000)
  • :retryable? - function that takes an error and returns whether to retry (default: connection errors only)