{"action":"created","issue":{"url":"https://api.github.com/repos/chef/chef-provisioning-docker/issues/80","repository_url":"https://api.github.com/repos/chef/chef-provisioning-docker","labels_url":"https://api.github.com/repos/chef/chef-provisioning-docker/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef-provisioning-docker/issues/80/comments","events_url":"https://api.github.com/repos/chef/chef-provisioning-docker/issues/80/events","html_url":"https://github.com/chef/chef-provisioning-docker/pull/80","id":138804503,"number":80,"title":"Replace FileUtils.copy in upload_file to use archive_in from docker-api","user":{"login":"Priminus","id":14960229,"avatar_url":"https://avatars.githubusercontent.com/u/14960229?v=3","gravatar_id":"","url":"https://api.github.com/users/Priminus","html_url":"https://github.com/Priminus","followers_url":"https://api.github.com/users/Priminus/followers","following_url":"https://api.github.com/users/Priminus/following{/other_user}","gists_url":"https://api.github.com/users/Priminus/gists{/gist_id}","starred_url":"https://api.github.com/users/Priminus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Priminus/subscriptions","organizations_url":"https://api.github.com/users/Priminus/orgs","repos_url":"https://api.github.com/users/Priminus/repos","events_url":"https://api.github.com/users/Priminus/events{/privacy}","received_events_url":"https://api.github.com/users/Priminus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-06T15:51:40Z","updated_at":"2016-03-07T22:08:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chef/chef-provisioning-docker/pulls/80","html_url":"https://github.com/chef/chef-provisioning-docker/pull/80","diff_url":"https://github.com/chef/chef-provisioning-docker/pull/80.diff","patch_url":"https://github.com/chef/chef-provisioning-docker/pull/80.patch"},"body":"In [`docker_transport.rb`](https://github.com/chef/chef-provisioning-docker/blob/master/lib/chef/provisioning/docker_driver/docker_transport.rb) \"upload_file\" is using FileUtils to write a file to container_path, which is defined as \"File.join('proc', container.info['State']['Pid'].to_s, 'root', path)\".\r\nMy CentOS Virtualbox VM uses /var/lib/docker/devicemapper/mnt/'container id'/rootfs as the container mount, so copying to \"/proc\" results in an error. The \"upload_file\" is invoked whenever there is the \"file\" resource used in a recipe.\r\nIn [`docker-api`, there's been an update in Jan 2016 which includes an 'archive_in' function](https://github.com/swipely/docker-api/blob/76cfcb98745a8bfca0f647df394cd884bf9dc16a/lib/docker/container.rb#L26). This tars up files on the host and untars it on the destination container. My change just creates the base directory in the container, untars the file there, and renames the file to whatever the user decided on in the \"remote_path\" parameter of the \"file\" resource."},"comment":{"url":"https://api.github.com/repos/chef/chef-provisioning-docker/issues/comments/193477591","html_url":"https://github.com/chef/chef-provisioning-docker/pull/80#issuecomment-193477591","issue_url":"https://api.github.com/repos/chef/chef-provisioning-docker/issues/80","id":193477591,"user":{"login":"jkeiser","id":654882,"avatar_url":"https://avatars.githubusercontent.com/u/654882?v=3","gravatar_id":"","url":"https://api.github.com/users/jkeiser","html_url":"https://github.com/jkeiser","followers_url":"https://api.github.com/users/jkeiser/followers","following_url":"https://api.github.com/users/jkeiser/following{/other_user}","gists_url":"https://api.github.com/users/jkeiser/gists{/gist_id}","starred_url":"https://api.github.com/users/jkeiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkeiser/subscriptions","organizations_url":"https://api.github.com/users/jkeiser/orgs","repos_url":"https://api.github.com/users/jkeiser/repos","events_url":"https://api.github.com/users/jkeiser/events{/privacy}","received_events_url":"https://api.github.com/users/jkeiser/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T22:08:04Z","updated_at":"2016-03-07T22:08:04Z","body":"@Priminus I just made a PR that does this slightly differently, using `write_file(path, IO.read(local_path))` ... can you check it out? It looks like `archive_in` handles mkdir -p automatically, too. https://github.com/chef/chef-provisioning-docker/pull/81"}}