Skip to content

Commit 6ff3623

Browse files
committed
Merge pull request #487 from maxamillion/get-image-docs
added docs for get_image
2 parents 5f552fd + cd0b648 commit 6ff3623

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
@@ -778,7 +798,6 @@ If `container` a dict, the `Id` key is used.
778798
TODO:
779799

780800
* events
781-
* get_image
782801
* load_image
783802
* resize
784803

0 commit comments

Comments
 (0)