Update container.py

Signed-off-by: Dan <31395415+cakedan@users.noreply.github.com>
This commit is contained in:
Dan 2023-02-22 23:29:03 -07:00 committed by GitHub
parent aaf68b7f98
commit cbd92808e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -957,7 +957,7 @@ class ContainerApiMixin:
return h_ports
@utils.check_resource('container')
def put_archive(self, container, path, data):
def put_archive(self, container, path, data, copy_uid_gid=False):
"""
Insert a file or folder in an existing container using a tar archive as
source.
@ -967,6 +967,7 @@ class ContainerApiMixin:
path (str): Path inside the container where the file(s) will be
extracted. Must exist.
data (bytes or stream): tar data to be extracted
copy_uid_gid (bool): copy UID/GID maps to the dest file or dir
Returns:
(bool): True if the call succeeds.
@ -975,7 +976,7 @@ class ContainerApiMixin:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
params = {'path': path}
params = {'path': path, 'copyUIDGID': copy_uid_gid}
url = self._url('/containers/{0}/archive', container)
res = self._put(url, params=params, data=data)
self._raise_for_status(res)