The docker API shows that the docker cli can be used to copy files to and from containers, but the only command I can find in the API is for copying an archive off the container.
https://docs.docker.com/engine/reference/commandline/cp/
docker==2.5.1
docker-pycreds==0.2.1
Python 3.5.3
Client:
Version: 1.12.6
API version: 1.24
Go version: go1.7.4
Git commit: 78d1802
Built: Tue Mar 14 09:47:15 2017
OS/Arch: linux/amd64
Server:
Version: 1.12.6
API version: 1.24
Go version: go1.7.4
Git commit: 78d1802
Built: Tue Mar 14 09:47:15 2017
OS/Arch: linux/amd64
Yes, put_archive and get_archive are the methods to use to copy to and from containers.
Are there any plans to match feature parity of docker cp? In my use case I am generating a single files that I wish to copy onto containers.
One problem with tar archives is that the historical tar formats do not support encodings, so they're not compatible with unicode filenames. Do you support the POSIX.1-2001 pax format which resolves this issue?
@egelmex:
There are a couple of ways to work around the absence of cp in the docker API.
Related: #1027 (if one of them should be closed due to being a duplicate, I would close #1027 because #1771 here is more general).
Also, is there a PR implementing a convenience method for this by now?
You can take a look at what we do in our integration tests: https://github.com/docker/docker-py/blob/master/tests/helpers.py#L29-L38
I don't think it's particularly necessary to add that kind of helper to the library. The current implementation matches what the API provides, has a clear interface and advertises clearly what the expected input/output is - that's not something I want to blur with additional convenience methods.
@shin-, fair enough, thanks for the example code from the integration tests! :+1:
Most helpful comment
Are there any plans to match feature parity of
docker cp? In my use case I am generating a single files that I wish to copy onto containers.