List images. Similar to the ``docker images`` command. Args: name (str): Only show images belonging to the repository ``name`` quiet (bool): Only return numeric IDs as a list. all (bool): Show intermediate image layers. By default, these are
(self, name=None, quiet=False, all=False, filters=None)
| 57 | return self._result(res, True) |
| 58 | |
| 59 | def images(self, name=None, quiet=False, all=False, filters=None): |
| 60 | """ |
| 61 | List images. Similar to the ``docker images`` command. |
| 62 | |
| 63 | Args: |
| 64 | name (str): Only show images belonging to the repository ``name`` |
| 65 | quiet (bool): Only return numeric IDs as a list. |
| 66 | all (bool): Show intermediate image layers. By default, these are |
| 67 | filtered out. |
| 68 | filters (dict): Filters to be processed on the image list. |
| 69 | Available filters: |
| 70 | - ``dangling`` (bool) |
| 71 | - `label` (str|list): format either ``"key"``, ``"key=value"`` |
| 72 | or a list of such. |
| 73 | |
| 74 | Returns: |
| 75 | (dict or list): A list if ``quiet=True``, otherwise a dict. |
| 76 | |
| 77 | Raises: |
| 78 | :py:class:`docker.errors.APIError` |
| 79 | If the server returns an error. |
| 80 | """ |
| 81 | params = { |
| 82 | 'only_ids': 1 if quiet else 0, |
| 83 | 'all': 1 if all else 0, |
| 84 | } |
| 85 | if name: |
| 86 | if utils.version_lt(self._version, '1.25'): |
| 87 | # only use "filter" on API 1.24 and under, as it is deprecated |
| 88 | params['filter'] = name |
| 89 | else: |
| 90 | if filters: |
| 91 | filters['reference'] = name |
| 92 | else: |
| 93 | filters = {'reference': name} |
| 94 | if filters: |
| 95 | params['filters'] = utils.convert_filters(filters) |
| 96 | res = self._result(self._get(self._url("/images/json"), params=params), |
| 97 | True) |
| 98 | if quiet: |
| 99 | return [x['Id'] for x in res] |
| 100 | return res |
| 101 | |
| 102 | def import_image(self, src=None, repository=None, tag=None, image=None, |
| 103 | changes=None, stream_src=False): |