mirror of https://github.com/docker/docker-py.git
Add doc example for get_archive
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
f83fe7c959
commit
cebdee4aef
|
@ -694,6 +694,18 @@ class ContainerApiMixin(object):
|
|||
Raises:
|
||||
:py:class:`docker.errors.APIError`
|
||||
If the server returns an error.
|
||||
|
||||
Example:
|
||||
|
||||
>>> c = docker.APIClient()
|
||||
>>> f = open('./sh_bin.tar', 'wb')
|
||||
>>> bits, stat = c.get_archive(container, '/bin/sh')
|
||||
>>> print(stat)
|
||||
{'name': 'sh', 'size': 1075464, 'mode': 493,
|
||||
'mtime': '2018-10-01T15:37:48-07:00', 'linkTarget': ''}
|
||||
>>> for chunk in bits:
|
||||
... f.write(chunk)
|
||||
>>> f.close()
|
||||
"""
|
||||
params = {
|
||||
'path': path
|
||||
|
|
|
@ -233,6 +233,17 @@ class Container(Model):
|
|||
Raises:
|
||||
:py:class:`docker.errors.APIError`
|
||||
If the server returns an error.
|
||||
|
||||
Example:
|
||||
|
||||
>>> f = open('./sh_bin.tar', 'wb')
|
||||
>>> bits, stat = container.get_archive('/bin/sh')
|
||||
>>> print(stat)
|
||||
{'name': 'sh', 'size': 1075464, 'mode': 493,
|
||||
'mtime': '2018-10-01T15:37:48-07:00', 'linkTarget': ''}
|
||||
>>> for chunk in bits:
|
||||
... f.write(chunk)
|
||||
>>> f.close()
|
||||
"""
|
||||
return self.client.api.get_archive(self.id, path, chunk_size)
|
||||
|
||||
|
|
Loading…
Reference in New Issue