List containers. Similar to the ``docker ps`` command. Args: all (bool): Show all containers. Only running containers are shown by default since (str): Show only containers created since Id or Name, include non-running ones
(self, all=False, before=None, filters=None, limit=-1, since=None,
sparse=False, ignore_removed=False)
| 955 | return self.prepare_model(resp) |
| 956 | |
| 957 | def list(self, all=False, before=None, filters=None, limit=-1, since=None, |
| 958 | sparse=False, ignore_removed=False): |
| 959 | """ |
| 960 | List containers. Similar to the ``docker ps`` command. |
| 961 | |
| 962 | Args: |
| 963 | all (bool): Show all containers. Only running containers are shown |
| 964 | by default |
| 965 | since (str): Show only containers created since Id or Name, include |
| 966 | non-running ones |
| 967 | before (str): Show only container created before Id or Name, |
| 968 | include non-running ones |
| 969 | limit (int): Show `limit` last created containers, include |
| 970 | non-running ones |
| 971 | filters (dict): Filters to be processed on the image list. |
| 972 | Available filters: |
| 973 | |
| 974 | - `exited` (int): Only containers with specified exit code |
| 975 | - `status` (str): One of ``restarting``, ``running``, |
| 976 | ``paused``, ``exited`` |
| 977 | - `label` (str|list): format either ``"key"``, ``"key=value"`` |
| 978 | or a list of such. |
| 979 | - `id` (str): The id of the container. |
| 980 | - `name` (str): The name of the container. |
| 981 | - `ancestor` (str): Filter by container ancestor. Format of |
| 982 | ``<image-name>[:tag]``, ``<image-id>``, or |
| 983 | ``<image@digest>``. |
| 984 | - `before` (str): Only containers created before a particular |
| 985 | container. Give the container name or id. |
| 986 | - `since` (str): Only containers created after a particular |
| 987 | container. Give container name or id. |
| 988 | |
| 989 | A comprehensive list can be found in the documentation for |
| 990 | `docker ps |
| 991 | <https://docs.docker.com/engine/reference/commandline/ps>`_. |
| 992 | |
| 993 | sparse (bool): Do not inspect containers. Returns partial |
| 994 | information, but guaranteed not to block. Use |
| 995 | :py:meth:`Container.reload` on resulting objects to retrieve |
| 996 | all attributes. Default: ``False`` |
| 997 | ignore_removed (bool): Ignore failures due to missing containers |
| 998 | when attempting to inspect containers from the original list. |
| 999 | Set to ``True`` if race conditions are likely. Has no effect |
| 1000 | if ``sparse=True``. Default: ``False`` |
| 1001 | |
| 1002 | Returns: |
| 1003 | (list of :py:class:`Container`) |
| 1004 | |
| 1005 | Raises: |
| 1006 | :py:class:`docker.errors.APIError` |
| 1007 | If the server returns an error. |
| 1008 | """ |
| 1009 | resp = self.client.api.containers(all=all, before=before, |
| 1010 | filters=filters, limit=limit, |
| 1011 | since=since) |
| 1012 | if sparse: |
| 1013 | return [self.prepare_model(r) for r in resp] |
| 1014 | else: |
nothing calls this directly
no test coverage detected