Reputation: 1678
How do you copy a file to a volume of a running docker container using the remote API?
I know about docker cp (https://docs.docker.com/engine/reference/commandline/cp/) but I would like to do this using the remote API.
I would like to do the equivalent of
docker cp path_to_local_file container:location_in_volume
Except I want to POST the file using the remote API.
I can't find anything about it in the remote API docs (https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/).
Is it possible?
Upvotes: 4
Views: 2568
Reputation: 2990
Use PUT archive:
PUT /containers/{container name or id}/archive?path={path in container} HTTP/1.1
Content-Type: application/x-tar
{{ TAR STREAM }}
The body of the request should be a tar file.
Upvotes: 4