'List containers. Similar to the ``docker ps`` command.
Args:
quiet (bool): Only display numeric Ids
all (bool): Show all containers. Only running containers are shown
by default trunc (bool): Truncate output
latest (bool): Show only the latest created container, include
non-running ones.
since (str): Show only containers created since Id or Name, include
non-running ones
before (str): Show only container created before Id or Name,
include non-running ones
limit (int): Show `limit` last created containers, include
non-running ones
size (bool): Display sizes
filters (dict): Filters to be processed on the image list.
Available filters:
- `exited` (int): Only containers with specified exit code
- `status` (str): One of ``restarting``, ``running``,
``paused``, ``exited``
- `label` (str): format either ``"key"`` or ``"key=value"``
- `id` (str): The id of the container.
- `name` (str): The name of the container.
- `ancestor` (str): Filter by container ancestor. Format of
``<image-name>[:tag]``, ``<image-id>``, or
``<image@digest>``.
- `before` (str): Only containers created before a particular
container. Give the container name or id.
- `since` (str): Only containers created after a particular
container. Give container name or id.
A comprehensive list can be found in the documentation for
`docker ps
<https://docs.docker.com/engine/reference/commandline/ps>`_.
Returns:
A list of dicts, one per container
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.'

def containers(self, quiet=False, all=False, trunc=False, latest=False, since=None, before=None, limit=(-1), size=False, filters=None):

    params = {'limit': (1 if latest else limit), 'all': (1 if all else 0), 'size': (1 if size else 0), 'trunc_cmd': (1 if trunc else 0), 'since': since, 'before': before}
    if filters:
        params['filters'] = utils.convert_filters(filters)
    u = self._url('/containers/json')
    res = self._result(self._get(u, params=params), True)
    if quiet:
        return [{'Id': x['Id']} for x in res]
    if trunc:
        for x in res:
            x['Id'] = x['Id'][:12]
    return res
