Skip to content

Fix image save example#2570

Merged
milas merged 1 commit into
docker:mainfrom
hristog:fix-image-save-example
Jul 29, 2022
Merged

Fix image save example#2570
milas merged 1 commit into
docker:mainfrom
hristog:fix-image-save-example

Conversation

@hristog
Copy link
Copy Markdown
Contributor

@hristog hristog commented May 24, 2020

Description

This fixes the Image.save() example (see original listing in the appendix below) by actually calling the save method.
The example doesn't seem to work, otherwise, due to the image object not being iterable.

Reference version:

>>> import docker
>>> docker.__version__
'4.3.0-dev'

Appendix A: Original example listing

        Example:
            >>> image = cli.get_image("busybox:latest")
            >>> f = open('/tmp/busybox-latest.tar', 'wb')
            >>> for chunk in image:
            >>>   f.write(chunk)
            >>> f.close()

Signed-off-by: Hristo Georgiev <hristo.a.georgiev@gmail.com>
@milas milas merged commit 52fb276 into docker:main Jul 29, 2022
@milas milas added this to the 6.0.0 milestone Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants