Skip to content

Commit cd0b648

Browse files
committed
added docs for get_image
1 parent 22dd8d7 commit cd0b648

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/api.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,26 @@ Export the contents of a filesystem as a tar archive to STDOUT
286286

287287
**Returns** (str): The filesystem tar archive as a str
288288

289+
## get_image
290+
291+
Get an image from the docker daemon. Similar to the `docker save` command.
292+
293+
**Params**:
294+
295+
* image (str): Image name to get
296+
297+
**Returns** (urllib3.response.HTTPResponse object): The response from the docker daemon
298+
299+
An example of how to get (save) an image to a file.
300+
```python
301+
>>> from docker import Client
302+
>>> cli = Client(base_url='unix://var/run/docker.sock')
303+
>>> image = cli.get_image(“fedora:latest”)
304+
>>> image_tar = open(‘/tmp/fedora-latest.tar’,’w’)
305+
>>> image_tar.write(image.data)
306+
>>> image_tar.close()
307+
```
308+
289309
## history
290310

291311
Show the history of an image
@@ -776,7 +796,6 @@ If `container` a dict, the `Id` key is used.
776796
TODO:
777797

778798
* events
779-
* get_image
780799
* load_image
781800
* resize
782801

0 commit comments

Comments
 (0)