docker cp to, from, and between containers#9871
Conversation
api/client/copy.go
Outdated
|
current issues:
|
|
Nice! CLI docs also need updating, which might also be a good opportunity to improve the I think the help text could explain that you can copy to/from/between containers, but it's quite hard to explain succinctly. Perhaps "Copy files/folders to and from containers, from SRCPATH to the DSTPATH". |
|
I wonder why the API Would it make sense to have a container's filesystem read/writable via a RESTful interface, i.e.;
(Though that feels a bit like re-inventing existing thinks, such as swift or WebDAV) |
api/client/copy.go
Outdated
|
@bfirsh said:
I'll add a commit which updates the docs and adds unit tests as soon as I get all of the behavior correct. |
|
@thaJeztah wrote:
There is currently a I'm worried that putting the /path/to/file directly in the path would result in ambiguities, apparently the container name can be Adding a |
Hm, then that problem should already be present when using the current end points (if my container is named Basically, my idea would be to have a |
|
Drone is really angry about this PR |
yeah, I'm still trying to get the behavior to match the old cp command. There are issues where the container path is not absolute and when it's from a volume. |
|
@LK4D4 drone loves these tests now! |
|
Btw this patch is awesome it behaves just like cp, and I love it! On Friday, January 2, 2015, Josh Hawn <[email protected]
|
|
I've just added some nice documentation/explanation to the first comment of this PR if anyone would like to take a look. |
|
this is great, thanks! I'm going to revisit using docker for my project now (currently using VMs, and workflow changes required to use containers weren't worth the benefits previously.) |
|
@jlhawn can you please move the documentation from the top comment, and into the documentation? (as proposals should be done docs PR first :) ) oh, and +1 ! |
|
@SvenDowideit Those are just docs for this PR. I haven't gotten to updating the actual docs yet. I'm working on a commit with unit tests and integration tests right now, then I'll finish off with a commit for the actual docs in the project ;-) |
|
^ oh! and rebase it so that it looks like the docs PR came first ;-) |
|
@jlhawn mmm, The problem I have, is that if i read detailed PR comments first, then the docs diff, I may not be confused by the docs, because i have the PR knowledge already. once merged, the user doesn't have this extra context. So I'd feel more comfortable with PR's having less detailed info, and thus everyone reviewing the PR will be reading the docs and tests to find out what the merged code will do. |
13e41d8 to
ffa9127
Compare
There was a problem hiding this comment.
Should this be formatted as a **note** to stand out a bit more ?
dda92fc to
d9acaf9
Compare
Documented changes to API to enable new `docker cp` behavior. Added documentation on `docker cp` usage and behavior. Fixed up the docs/man/README.md file a bit. Docker-DCO-1.1-Signed-off-by: Josh Hawn <[email protected]> (github: jlhawn)
Adds CopyFrom and CopyTo functions to be used for creating archives for use with the new `docker cp` behavior. Adds multiple test cases for the CopyFrom and CopyTo functions in the pkg/archive package. Signed-off-by: Josh Hawn <[email protected]> (github: jlhawn)
Adds new jobs for handling copying to, from, or between containers. To be used by the API for new endpoints making new `docker cp` behavior possible. Uses new pkg/archive and pkg/chrootarchive utilities for archiving filesystem contents especially for this purpose. Docker-DCO-1.1-Signed-off-by: Josh Hawn <[email protected]> (github: jlhawn)
New endpoints have been added for copying to, from, and between containers. These endpoints call out to jobs registered by the daemon for handling each of these cases. Each handler uses a common error handling function for errors from these jobs before returning an error, if any. To be used by CLI for changes to `docker cp`. Signed-off-by: Josh Hawn <[email protected]> (github: jlhawn)
Utilizes new Remote API endpoints to handle copying to, from, and between containers in a manner that matches other common Unix utilities like `cp` and `scp`. Signed-off-by: Josh Hawn <[email protected]> (github: jlhawn)
Adds several integration tests for `docker cp` behavior with over a dozen tests for each of: container -> local local -> container container -> container Also adds several more integration tests with `docker cp` when volumes are involved in the paths which are being copied. Signed-off-by: Josh Hawn <[email protected]> (github: jlhawn)
Fixes moby#9787 Signed-off-by: Brian Goff <[email protected]>
|
@jlhawn Thank you for implementing this. Fantastic. |
|
For anyone else interested (already showed it to @jlhawn yesterday), I made a proof of concept for an alternative API for this. API is basically simple get(similar to what docker currently does) and idempotent push. The exception cases for |
|
as @tonistiigi alluded above, I'll be reworking this soon (currently working on a few other things) to make the api changes for less complex logic on the server side. The changes would be:
Together, these endpoints should give the client all of the necessary tools to cleanly implement |
|
If there is just one resource, is there any reason we're not including the path to the resource in the URL itself? Then we may not even need an HTTP body on the GET and we could use HEAD for the query one. Just to be more RESTful. |
|
@duglin putting the path in the url was something that was discussed above with @thaJeztah. The issue was that the container |
|
Status Update! I've made a lot of progress on "Take 3" of this PR ;-) All of the tests are passing with the new implementation. I just need to update the docs. I should have it pushed some time this weekend. |
|
@jlhawn Great news! Maybe consider making a new PR then and closing this one. This one is already hard to scroll and contains a lot of outdated information that may confuse new people looking at it. |
|
@tonistiigi @duglin et al, Everything is ready to go, I just need to split up some commits. Then I'll close this one and open up a shiny new 5-digit pull request. |
|
Closed in favor of #10198 |
please check the first commit with documentation changes for details