Pull an image of the given name and return it. Similar to the ``docker pull`` command. If ``tag`` is ``None`` or empty, it is set to ``latest``. If ``all_tags`` is set, the ``tag`` parameter is ignored and all image tags will be pulled. If you want t
(self, repository, tag=None, all_tags=False, **kwargs)
| 413 | return [self.get(i) for i in images] |
| 414 | |
| 415 | def pull(self, repository, tag=None, all_tags=False, **kwargs): |
| 416 | """ |
| 417 | Pull an image of the given name and return it. Similar to the |
| 418 | ``docker pull`` command. |
| 419 | If ``tag`` is ``None`` or empty, it is set to ``latest``. |
| 420 | If ``all_tags`` is set, the ``tag`` parameter is ignored and all image |
| 421 | tags will be pulled. |
| 422 | |
| 423 | If you want to get the raw pull output, use the |
| 424 | :py:meth:`~docker.api.image.ImageApiMixin.pull` method in the |
| 425 | low-level API. |
| 426 | |
| 427 | Args: |
| 428 | repository (str): The repository to pull |
| 429 | tag (str): The tag to pull |
| 430 | auth_config (dict): Override the credentials that are found in the |
| 431 | config for this request. ``auth_config`` should contain the |
| 432 | ``username`` and ``password`` keys to be valid. |
| 433 | platform (str): Platform in the format ``os[/arch[/variant]]`` |
| 434 | all_tags (bool): Pull all image tags |
| 435 | |
| 436 | Returns: |
| 437 | (:py:class:`Image` or list): The image that has been pulled. |
| 438 | If ``all_tags`` is True, the method will return a list |
| 439 | of :py:class:`Image` objects belonging to this repository. |
| 440 | |
| 441 | Raises: |
| 442 | :py:class:`docker.errors.APIError` |
| 443 | If the server returns an error. |
| 444 | |
| 445 | Example: |
| 446 | |
| 447 | >>> # Pull the image tagged `latest` in the busybox repo |
| 448 | >>> image = client.images.pull('busybox') |
| 449 | |
| 450 | >>> # Pull all tags in the busybox repo |
| 451 | >>> images = client.images.pull('busybox', all_tags=True) |
| 452 | """ |
| 453 | repository, image_tag = parse_repository_tag(repository) |
| 454 | tag = tag or image_tag or 'latest' |
| 455 | |
| 456 | if 'stream' in kwargs: |
| 457 | warnings.warn( |
| 458 | '`stream` is not a valid parameter for this method' |
| 459 | ' and will be overridden', |
| 460 | stacklevel=1, |
| 461 | ) |
| 462 | del kwargs['stream'] |
| 463 | |
| 464 | pull_log = self.client.api.pull( |
| 465 | repository, tag=tag, stream=True, all_tags=all_tags, **kwargs |
| 466 | ) |
| 467 | for _ in pull_log: |
| 468 | # We don't do anything with the logs, but we need |
| 469 | # to keep the connection alive and wait for the image |
| 470 | # to be pulled. |
| 471 | pass |
| 472 | if not all_tags: |
nothing calls this directly
no test coverage detected