Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/api/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ def pull(self, repository, tag=None, stream=False, auth_config=None,
Args:
repository (str): The repository to pull
tag (str): The tag to pull
stream (bool): Stream the output as a generator
stream (bool): Stream the output as a generator. Make sure to
consume the generator, otherwise pull might get cancelled.
auth_config (dict): Override the credentials that
:py:meth:`~docker.api.daemon.DaemonApiMixin.login` has set for
this request. ``auth_config`` should contain the ``username``
Expand Down
1 change: 1 addition & 0 deletions docker/models/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ def pull(self, repository, tag=None, **kwargs):
if not tag:
repository, tag = parse_repository_tag(repository)

kwargs['stream'] = False
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt that that the pull log can be big enough to cause memory issues.

self.client.api.pull(repository, tag=tag, **kwargs)
if tag:
return self.get('{0}{2}{1}'.format(
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/models_containers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ def test_run_pull(self):
container = client.containers.run('alpine', 'sleep 300', detach=True)

assert container.id == FAKE_CONTAINER_ID
client.api.pull.assert_called_with('alpine', platform=None, tag=None)
client.api.pull.assert_called_with('alpine', platform=None, tag=None,
stream=False)

def test_run_with_error(self):
client = make_fake_client()
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/models_images_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ def test_load(self):
def test_pull(self):
client = make_fake_client()
image = client.images.pull('test_image:latest')
client.api.pull.assert_called_with('test_image', tag='latest')
client.api.pull.assert_called_with('test_image', tag='latest',
stream=False)
client.api.inspect_image.assert_called_with('test_image:latest')
assert isinstance(image, Image)
assert image.id == FAKE_IMAGE_ID

def test_pull_multiple(self):
client = make_fake_client()
images = client.images.pull('test_image')
client.api.pull.assert_called_with('test_image', tag=None)
client.api.pull.assert_called_with('test_image', tag=None,
stream=False)
client.api.images.assert_called_with(
all=False, name='test_image', filters=None
)
Expand Down