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

API calls for all endpoints tagged `Network`.

# `network_connect`

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

Connect a container to a network

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Network ID or name
- `container` (NetworkConnectRequest): 
- `opts` (keyword): Optional parameters

### Returns

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

# `network_create`

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

Create a network

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `network_config` (NetworkCreateRequest): Network configuration
- `opts` (keyword): Optional parameters

### Returns

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

# `network_delete`

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

Remove a network

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Network ID or name
- `opts` (keyword): Optional parameters

### Returns

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

# `network_disconnect`

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

Disconnect a container from a network

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Network ID or name
- `container` (NetworkDisconnectRequest): 
- `opts` (keyword): Optional parameters

### Returns

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

# `network_inspect`

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

Inspect a network

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Network ID or name
- `opts` (keyword): Optional parameters
  - `:verbose` (boolean()): Detailed inspect output for troubleshooting
  - `:scope` (String.t): Filter the network by scope (swarm, global, or local)

### Returns

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

# `network_list`

```elixir
@spec network_list(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, DockerEngineAPI.Model.ErrorResponse.t()}
  | {:ok, [DockerEngineAPI.Model.Network.t()]}
  | {:error, Tesla.Env.t()}
```

List networks
Returns a list of networks. For details on the format, see the [network inspect endpoint](#operation/NetworkInspect).  Note that it uses a different, smaller representation of a network than inspecting a single network. For example, the list of containers attached to the network is not propagated in API versions 1.28 and up. 

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
  - `:filters` (String.t): JSON encoded value of the filters (a `map[string][]string`) to process on the networks list.  Available filters:  - `dangling=<boolean>` When set to `true` (or `1`), returns all    networks that are not in use by a container. When set to `false`    (or `0`), only networks that are in use by one or more    containers are returned. - `driver=<driver-name>` Matches a network's driver. - `id=<network-id>` Matches all or part of a network ID. - `label=<key>` or `label=<key>=<value>` of a network label. - `name=<network-name>` Matches all or part of a network name. - `scope=["swarm"|"global"|"local"]` Filters networks by scope (`swarm`, `global`, or `local`). - `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks. 

### Returns

- `{:ok, [%Network{}, ...]}` on success
- `{:error, Tesla.Env.t}` on failure

# `network_prune`

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

Delete unused networks

### Parameters

- `connection` (DockerEngineAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
  - `:filters` (String.t): Filters to process on the prune list, encoded as JSON (a `map[string][]string`).  Available filters: - `until=<timestamp>` Prune networks created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune networks with (or without, in case `label!=...` is used) the specified labels. 

### Returns

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

---

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