List networks. Similar to the ``docker network ls`` command. Args: names (:py:class:`list`): List of names to filter by. ids (:py:class:`list`): List of ids to filter by. filters (dict): Filters to be processed on the network list.
(self, *args, **kwargs)
| 183 | ) |
| 184 | |
| 185 | def list(self, *args, **kwargs): |
| 186 | """ |
| 187 | List networks. Similar to the ``docker network ls`` command. |
| 188 | |
| 189 | Args: |
| 190 | names (:py:class:`list`): List of names to filter by. |
| 191 | ids (:py:class:`list`): List of ids to filter by. |
| 192 | filters (dict): Filters to be processed on the network list. |
| 193 | Available filters: |
| 194 | - ``driver=[<driver-name>]`` Matches a network's driver. |
| 195 | - `label` (str|list): format either ``"key"``, ``"key=value"`` |
| 196 | or a list of such. |
| 197 | - ``type=["custom"|"builtin"]`` Filters networks by type. |
| 198 | greedy (bool): Fetch more details for each network individually. |
| 199 | You might want this to get the containers attached to them. |
| 200 | |
| 201 | Returns: |
| 202 | (list of :py:class:`Network`) The networks on the server. |
| 203 | |
| 204 | Raises: |
| 205 | :py:class:`docker.errors.APIError` |
| 206 | If the server returns an error. |
| 207 | """ |
| 208 | greedy = kwargs.pop('greedy', False) |
| 209 | resp = self.client.api.networks(*args, **kwargs) |
| 210 | networks = [self.prepare_model(item) for item in resp] |
| 211 | if greedy and version_gte(self.client.api._version, '1.28'): |
| 212 | for net in networks: |
| 213 | net.reload() |
| 214 | return networks |
| 215 | |
| 216 | def prune(self, filters=None): |
| 217 | return self.client.api.prune_networks(filters=filters) |
nothing calls this directly
no test coverage detected