View Source DockerEngineAPI.Api.Network (docker_engine_api v1.43.0)

API calls for all endpoints tagged Network.

Summary

Functions

Disconnect a container from a network

List networks Returns a list of networks. For details on the format, see the network inspect endpoint. 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.

Delete unused networks

Functions

Link to this function

network_connect(connection, id, container, opts \\ [])

View Source

Connect a container to a network

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • id (String.t): Network ID or name
  • container (NetworkConnectRequest):
  • opts (KeywordList): [optional] Optional parameters

Returns

} on success {:error, info} on failure

Link to this function

network_create(connection, network_config, opts \\ [])

View Source

Create a network

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • network_config (NetworkCreateRequest): Network configuration
  • opts (KeywordList): [optional] Optional parameters

Returns

} on success {:error, info} on failure

Link to this function

network_delete(connection, id, opts \\ [])

View Source

Remove a network

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • id (String.t): Network ID or name
  • opts (KeywordList): [optional] Optional parameters

Returns

} on success {:error, info} on failure

Link to this function

network_disconnect(connection, id, container, opts \\ [])

View Source

Disconnect a container from a network

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • id (String.t): Network ID or name
  • container (NetworkDisconnectRequest):
  • opts (KeywordList): [optional] Optional parameters

Returns

} on success {:error, info} on failure

Link to this function

network_inspect(connection, id, opts \\ [])

View Source

Inspect a network

Parameters

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

Returns

} on success {:error, info} on failure

Link to this function

network_list(connection, opts \\ [])

View Source

List networks Returns a list of networks. For details on the format, see the network inspect endpoint. 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 (KeywordList): [optional] 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

, ...]} on success {:error, info} on failure

Link to this function

network_prune(connection, opts \\ [])

View Source

Delete unused networks

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • opts (KeywordList): [optional] 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

} on success {:error, info} on failure