# `Docker.Debug.Retry`
[🔗](https://github.com/joshrotenberg/docker_wrapper_ex/blob/v0.1.2/lib/docker/debug/retry.ex#L1)

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
    )

# `backoff`

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

# `retryable_fun`

```elixir
@type retryable_fun() :: (term() -&gt; boolean())
```

# `t`

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

# `default_retryable?`

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

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

# `delay`

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

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

# `new`

```elixir
@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)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
