New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow copying files/dirs to a container - simpler implementation #13125
Conversation
// CmdCp copies files/folders from a path on the container to a directory on the host running the command. | ||
// | ||
// If HOSTDIR is '-', the data is written as a tar file to STDOUT. | ||
// If LOCALPATH is '-' and the second arg, the data is written as a tar file to STDOUT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/and/for/ on this line and next.
func (cli *DockerCli) CmdCp(args ...string) error { | ||
cmd := cli.Subcmd("cp", "CONTAINER:PATH HOSTDIR|-", "Copy files/folders from a PATH on the container to a HOSTDIR on the host\nrunning the command. Use '-' to write the data as a tar file to STDOUT.", true) | ||
cmd := cli.Subcmd("cp", "CONTAINER:PATH|LOCALPATH|- CONTAINER:PATH|LOCALPATH|-", "Copy files/folders to or from the container", true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until we support container <-> container stuff it might be better to write this as something like:
[CONTAINER:PATH LOCALPATH|-] | [LOCALPATH|- CONTAINER:PATH]
ping @jlhawn |
4fa34a7
to
5e52b5e
Compare
Windows failure is due to some parsing issues in determining if the arg is a file path or a container+path. Will have to look more at it later. But otherwise if we agree we want this functionality (and I think we have in the other PR) I'd like to get this moved to code-review. |
c32252e
to
2444f20
Compare
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Windows path errors all fixed. |
Lets not do competing implementations of exiting PRs. Lets start working with the original authors and contributors can collaborate on their forks and get the implementations worked out and have a joint PR opened that everyone is proud of. |
This is a simpler implementation of #10198
Does not support copying files between containers, though this could be done via:
When copying from a container it will use
GET /containers/<id>/copy
, copying to a container would bePOST /containers/<id>/copy?to=<path>
The
postContainersCopy
method will proxy togetContainersCopy
for older API versions.Closes #10198 #5846