# `DockerEngineAPI.Api.Exec`
[🔗](https://github.com/testcontainers/testcontainers-elixir/blob/main/docker_engine_api/api/exec.ex#L4)

API calls for all endpoints tagged `Exec`.

# `container_exec`

```elixir
@spec container_exec(
  Tesla.Env.client(),
  String.t(),
  DockerEngineAPI.Model.ExecConfig.t(),
  keyword()
) ::
  {:ok, DockerEngineAPI.Model.ErrorResponse.t()}
  | {:ok, DockerEngineAPI.Model.IdResponse.t()}
  | {:error, Tesla.Env.t()}
```

Create an exec instance
Run a command inside a running container.

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): ID or name of container
- `exec_config` (ExecConfig): Exec configuration
- `opts` (keyword): Optional parameters

### Returns

- `{:ok, DockerEngineAPI.Model.IdResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure

# `exec_inspect`

```elixir
@spec exec_inspect(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, DockerEngineAPI.Model.ErrorResponse.t()}
  | {:ok, DockerEngineAPI.Model.ExecInspectResponse.t()}
  | {:error, Tesla.Env.t()}
```

Inspect an exec instance
Return low-level information about an exec instance.

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Exec instance ID
- `opts` (keyword): Optional parameters

### Returns

- `{:ok, DockerEngineAPI.Model.ExecInspectResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure

# `exec_resize`

```elixir
@spec exec_resize(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil}
  | {:ok, DockerEngineAPI.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}
```

Resize an exec instance
Resize the TTY session used by an exec instance. This endpoint only works if `tty` was specified as part of creating and starting the exec instance.

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Exec instance ID
- `opts` (keyword): Optional parameters
  - `:h` (integer()): Height of the TTY session in characters
  - `:w` (integer()): Width of the TTY session in characters

### Returns

- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure

# `exec_start`

```elixir
@spec exec_start(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Tesla.Env.t() | DockerEngineAPI.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}
```

Start an exec instance
Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Otherwise, it sets up an interactive session with the command.

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Exec instance ID
- `opts` (keyword): Optional parameters
  - `:body` (ExecStartConfig):

### Returns

- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure

---

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