{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/13171","labels_url":"https://api.github.com/repos/docker/docker/issues/13171/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/13171/comments","events_url":"https://api.github.com/repos/docker/docker/issues/13171/events","html_url":"https://github.com/docker/docker/pull/13171","id":75802739,"number":13171,"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},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/status/2-needs-code-review","name":"status/2-needs-code-review","color":"fad8c7"}],"state":"open","locked":false,"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/38","html_url":"https://github.com/docker/docker/milestones/1.7.0","labels_url":"https://api.github.com/repos/docker/docker/milestones/38/labels","id":1010239,"number":38,"title":"1.7.0","description":"Freeze May 26\r\nRelease  June 16","creator":{"login":"dmcgowan","id":169601,"avatar_url":"https://avatars.githubusercontent.com/u/169601?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcgowan","html_url":"https://github.com/dmcgowan","followers_url":"https://api.github.com/users/dmcgowan/followers","following_url":"https://api.github.com/users/dmcgowan/following{/other_user}","gists_url":"https://api.github.com/users/dmcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcgowan/subscriptions","organizations_url":"https://api.github.com/users/dmcgowan/orgs","repos_url":"https://api.github.com/users/dmcgowan/repos","events_url":"https://api.github.com/users/dmcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/dmcgowan/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":23,"state":"open","created_at":"2015-03-07T01:54:49Z","updated_at":"2015-05-21T00:57:15Z","due_on":"2015-05-26T07:00:00Z","closed_at":null},"comments":26,"created_at":"2015-05-13T01:25:08Z","updated_at":"2015-05-21T20:01:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/13171","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"},"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"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/104404169","html_url":"https://github.com/docker/docker/pull/13171#issuecomment-104404169","issue_url":"https://api.github.com/repos/docker/docker/issues/13171","id":104404169,"user":{"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},"created_at":"2015-05-21T20:01:10Z","updated_at":"2015-05-21T20:01:10Z","body":"Sorry if I misunderstand, but IIUC, the intent is to replicate the UI/behavior of `cp`, not `tar`, tar only being the \"transport\" mechanism here?"}}