I am using docker-py. I want to copy a file from docker container to host machine.
From docker-py documentation:
copy
Identical to the docker cp command. Get files/folders from the container.
Params:
container (str): The container to copy from
resource (str): The path within the container
Returns (str): The contents of the file as a string
I could create container and start it but unable to get the file which gets copied from container to host. Can someone help me in pointing out if I am missing anything? I have /mydir/myshell.sh in my docker container which I tried copying to host.
>>> a = c.copy(container="7eb334c512c57d37e38161ab7aad014ebaf6a622e4b8c868d7a666e1d855d217", resource="/mydir/myshell.sh") >>> a
<requests.packages.urllib3.response.HTTPResponse object at 0x7f2f2aa57050>
>>> type(a)
<class 'requests.packages.urllib3.response.HTTPResponse'>
It will be very helpful if someone can help me figuring out whether it is copying or not even copying the file.