{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/35161549","id":35161549,"diff_hunk":"@@ -1061,6 +1063,112 @@ Status Codes:\n -   **404** – no such container\n -   **500** – server error\n \n+### Get an archive of a filesytem resource in a container\n+\n+`GET /containers/(id)/archive`\n+\n+Get an tar archive of a resource in the filesystem of container `id`.\n+\n+Query Parameters:\n+\n+- **path** - resource in the container's filesystem to archive. Required.\n+\n+    If not an absolute path, it is relative to the container's root directory.\n+    The resource specified by **path** must exist. To assert that the resource\n+    is expected to be a directory, **path** should end in `/` or  `/.`\n+    (assuming a path separator of `/`). If **path** ends in `/.` then this\n+    indicates that only the contents of the **path** directory should be\n+    copied. A symlink is always resolved to its target.\n+\n+    > It is not possible to copy certain system files such as resources under\n+    > `/proc`, `/sys`, `/dev`, and mounts created by the user in the container.\n+","path":"docs/reference/api/docker_remote_api_v1.20.md","position":32,"original_position":32,"commit_id":"1f8d02cbf11ad6f76be8dfbb6243a15af81cfbf3","original_commit_id":"1f8d02cbf11ad6f76be8dfbb6243a15af81cfbf3","user":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"body":"No, you can. 'mounts created by the user in the container' includes things like FUSE mounts made by the process(es) in the container or anything added to fstab after the container is created.","created_at":"2015-07-21T22:18:47Z","updated_at":"2015-07-21T22:18:47Z","html_url":"https://github.com/docker/docker/pull/13171#discussion_r35161549","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/13171","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/35161549"},"html":{"href":"https://github.com/docker/docker/pull/13171#discussion_r35161549"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/13171"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/13171","id":35286801,"html_url":"https://github.com/docker/docker/pull/13171","diff_url":"https://github.com/docker/docker/pull/13171.diff","patch_url":"https://github.com/docker/docker/pull/13171.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/13171","number":13171,"state":"open","locked":false,"title":"docker cp to and from containers","user":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"body":"## Copy files/folders between containers and the local filesystem.\r\n\r\n    Usage:  docker cp [options] CONTAINER:PATH LOCALPATH|-\r\n            docker cp [options] LOCALPATH|- CONTAINER:PATH\r\n\r\n    --help  Print usage statement\r\n\r\nIn the first synopsis form, the `docker cp` utility copies the contents of\r\n`PATH` from the filesystem of `CONTAINER` to the `LOCALPATH` (or stream as\r\na Tar Archive to `STDOUT` if `-` is specified).\r\n\r\nIn the second synopsis form, the contents of `LOCALPATH` (or a Tar Archive\r\nstreamed from `STDIN` if `-` is specified) are copied from the local machine to\r\n`PATH` in the filesystem of `CONTAINER`.\r\n\r\nYou can copy to or from either a running or stopped container. The `PATH` can\r\nbe a file or directory. The `docker cp` command assumes all `CONTAINER:PATH`\r\nvalues are relative to the `/` (root) directory of the container. This means\r\nsupplying the initial forward slash is optional; The command sees\r\n`compassionate_darwin:/tmp/foo/myfile.txt` and\r\n`compassionate_darwin:tmp/foo/myfile.txt` as identical. If a `LOCALPATH` value\r\nis not absolute, is it considered relative to the current working directory.\r\n\r\nBehavior is similar to the common Unix utility `cp -a` in that directories are\r\ncopied recursively and file mode, permission, and ownership are preserved if\r\npossible.\r\n\r\nAssuming a path separator of `/`, a first argument of `SRC_PATH` and second\r\nargument of `DST_PATH`, the behavior is as follows:\r\n\r\n- `SRC_PATH` specifies a file\r\n    - `DST_PATH` does not exist\r\n        - the file is saved to a file created at `DST_PATH`\r\n    - `DST_PATH` does not exist and ends with `/`\r\n        - Error condition: the destination directory must exist.\r\n    - `DST_PATH` exists and is a file\r\n        - the destination is overwritten with the contents of the source file\r\n    - `DST_PATH` exists and is a directory\r\n        - the file is copied into this directory using the basename from\r\n          `SRC_PATH`\r\n- `SRC_PATH` specifies a directory\r\n    - `DST_PATH` does not exist\r\n        - `DST_PATH` is created as a directory and the *contents* of the source\r\n           directory are copied into this directory\r\n    - `DST_PATH` exists and is a file\r\n        - Error condition: cannot copy a directory to a file\r\n    - `DST_PATH` exists and is a directory\r\n        - `SRC_PATH` does not end with `/.`\r\n            - the source directory is copied into this directory\r\n        - `SRC_PAPTH` does end with `/.`\r\n            - the *content* of the source directory is copied into this\r\n              directory\r\n\r\nThe command requires `SRC_PATH` and `DST_PATH` to exist according to the above\r\nrules. If `SRC_PATH` is a symbolic link, the symbolic link, not the target, is\r\ncopied. If a path separator immediately follows the symbolic link, it will be\r\nresolved to its target and the target resource will be copied.\r\n\r\nA colon (`:`) is used as a delimiter between `CONTAINER` and `PATH`, but `:`\r\ncould also be in a valid `LOCALPATH`, like `file:name.txt`. This ambiguity is\r\nresolved by requiring a `LOCALPATH` with a `:` to be made explicit with a\r\nrelative or absolute path, for example:\r\n\r\n    `/path/to/file:name.txt` or `./file:name.txt`\r\n\r\nIt is not possible to copy certain system files such as resources under\r\n`/proc`, `/sys`, `/dev`, and mounts created by the user in the container.\r\n\r\nUsing `-` as the first argument in place of a `LOCALPATH` will stream the\r\ncontents of `STDIN` as a Tar Archive which will be extracted to the `PATH` in\r\nthe filesystem of the destination container. In this case, `PATH` must specify\r\na directory.\r\n\r\nUsing `-` as the second argument in place of a `LOCALPATH` will stream the\r\ncontents of the resource from the source container as a Tar Archive to\r\n`STDOUT`.\r\n\r\nreplaces https://github.com/docker/docker/pull/10198\r\n\r\nfixes #5846\r\nfixes #4272\r\nfixes #10040","created_at":"2015-05-13T01:25:08Z","updated_at":"2015-07-21T22:18:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7ad32b5fbcfe2e523019390b0e09146b3e36618","assignee":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/docker/docker/milestones/39","html_url":"https://github.com/docker/docker/milestones/1.8.0","labels_url":"https://api.github.com/repos/docker/docker/milestones/39/labels","id":1151952,"number":39,"title":"1.8.0","description":"","creator":{"login":"thaJeztah","id":1804568,"avatar_url":"https://avatars.githubusercontent.com/u/1804568?v=3","gravatar_id":"","url":"https://api.github.com/users/thaJeztah","html_url":"https://github.com/thaJeztah","followers_url":"https://api.github.com/users/thaJeztah/followers","following_url":"https://api.github.com/users/thaJeztah/following{/other_user}","gists_url":"https://api.github.com/users/thaJeztah/gists{/gist_id}","starred_url":"https://api.github.com/users/thaJeztah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaJeztah/subscriptions","organizations_url":"https://api.github.com/users/thaJeztah/orgs","repos_url":"https://api.github.com/users/thaJeztah/repos","events_url":"https://api.github.com/users/thaJeztah/events{/privacy}","received_events_url":"https://api.github.com/users/thaJeztah/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":30,"state":"open","created_at":"2015-06-05T19:27:06Z","updated_at":"2015-07-21T21:23:27Z","due_on":"2015-08-09T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/docker/docker/pulls/13171/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/13171/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/13171/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/1f8d02cbf11ad6f76be8dfbb6243a15af81cfbf3","head":{"label":"jlhawn:archive_copy","ref":"archive_copy","sha":"1f8d02cbf11ad6f76be8dfbb6243a15af81cfbf3","user":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"repo":{"id":14341765,"name":"docker","full_name":"jlhawn/docker","owner":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jlhawn/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/jlhawn/docker","forks_url":"https://api.github.com/repos/jlhawn/docker/forks","keys_url":"https://api.github.com/repos/jlhawn/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jlhawn/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jlhawn/docker/teams","hooks_url":"https://api.github.com/repos/jlhawn/docker/hooks","issue_events_url":"https://api.github.com/repos/jlhawn/docker/issues/events{/number}","events_url":"https://api.github.com/repos/jlhawn/docker/events","assignees_url":"https://api.github.com/repos/jlhawn/docker/assignees{/user}","branches_url":"https://api.github.com/repos/jlhawn/docker/branches{/branch}","tags_url":"https://api.github.com/repos/jlhawn/docker/tags","blobs_url":"https://api.github.com/repos/jlhawn/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jlhawn/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jlhawn/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/jlhawn/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jlhawn/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/jlhawn/docker/languages","stargazers_url":"https://api.github.com/repos/jlhawn/docker/stargazers","contributors_url":"https://api.github.com/repos/jlhawn/docker/contributors","subscribers_url":"https://api.github.com/repos/jlhawn/docker/subscribers","subscription_url":"https://api.github.com/repos/jlhawn/docker/subscription","commits_url":"https://api.github.com/repos/jlhawn/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/jlhawn/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/jlhawn/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/jlhawn/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/jlhawn/docker/contents/{+path}","compare_url":"https://api.github.com/repos/jlhawn/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jlhawn/docker/merges","archive_url":"https://api.github.com/repos/jlhawn/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jlhawn/docker/downloads","issues_url":"https://api.github.com/repos/jlhawn/docker/issues{/number}","pulls_url":"https://api.github.com/repos/jlhawn/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/jlhawn/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/jlhawn/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jlhawn/docker/labels{/name}","releases_url":"https://api.github.com/repos/jlhawn/docker/releases{/id}","created_at":"2013-11-12T18:50:12Z","updated_at":"2015-05-06T21:32:40Z","pushed_at":"2015-07-21T22:06:30Z","git_url":"git://github.com/jlhawn/docker.git","ssh_url":"git@github.com:jlhawn/docker.git","clone_url":"https://github.com/jlhawn/docker.git","svn_url":"https://github.com/jlhawn/docker","homepage":"http://www.docker.io","size":63526,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":5,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"3ee15acaadc3f25c90ea2c4de2e5ab1a12d8e042","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-07-21T22:05:42Z","pushed_at":"2015-07-21T22:06:49Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":228770,"stargazers_count":23428,"watchers_count":23428,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5838,"mirror_url":null,"open_issues_count":1084,"forks":5838,"open_issues":1084,"watchers":23428,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/13171"},"html":{"href":"https://github.com/docker/docker/pull/13171"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/13171"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/13171/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/13171/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/13171/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/1f8d02cbf11ad6f76be8dfbb6243a15af81cfbf3"}}}}