Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but allows importing in-memory bytes data. Args: data (bytes collection): Bytes collection containing valid tar data repository (str): The repository to create tag (str): The t
(self, data, repository=None, tag=None,
changes=None)
| 152 | ) |
| 153 | |
| 154 | def import_image_from_data(self, data, repository=None, tag=None, |
| 155 | changes=None): |
| 156 | """ |
| 157 | Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but |
| 158 | allows importing in-memory bytes data. |
| 159 | |
| 160 | Args: |
| 161 | data (bytes collection): Bytes collection containing valid tar data |
| 162 | repository (str): The repository to create |
| 163 | tag (str): The tag to apply |
| 164 | """ |
| 165 | |
| 166 | u = self._url('/images/create') |
| 167 | params = _import_image_params( |
| 168 | repository, tag, src='-', changes=changes |
| 169 | ) |
| 170 | headers = {'Content-Type': 'application/tar'} |
| 171 | return self._result( |
| 172 | self._post( |
| 173 | u, data=data, params=params, headers=headers, timeout=None |
| 174 | ) |
| 175 | ) |
| 176 | |
| 177 | def import_image_from_file(self, filename, repository=None, tag=None, |
| 178 | changes=None): |