{"action":"created","issue":{"url":"https://api.github.com/repos/boot2docker/boot2docker/issues/1021","labels_url":"https://api.github.com/repos/boot2docker/boot2docker/issues/1021/labels{/name}","comments_url":"https://api.github.com/repos/boot2docker/boot2docker/issues/1021/comments","events_url":"https://api.github.com/repos/boot2docker/boot2docker/issues/1021/events","html_url":"https://github.com/boot2docker/boot2docker/issues/1021","id":99208926,"number":1021,"title":"-v/VOLUME inconsistencies","user":{"login":"krainboltgreene","id":334809,"avatar_url":"https://avatars.githubusercontent.com/u/334809?v=3","gravatar_id":"","url":"https://api.github.com/users/krainboltgreene","html_url":"https://github.com/krainboltgreene","followers_url":"https://api.github.com/users/krainboltgreene/followers","following_url":"https://api.github.com/users/krainboltgreene/following{/other_user}","gists_url":"https://api.github.com/users/krainboltgreene/gists{/gist_id}","starred_url":"https://api.github.com/users/krainboltgreene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krainboltgreene/subscriptions","organizations_url":"https://api.github.com/users/krainboltgreene/orgs","repos_url":"https://api.github.com/users/krainboltgreene/repos","events_url":"https://api.github.com/users/krainboltgreene/events{/privacy}","received_events_url":"https://api.github.com/users/krainboltgreene/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-05T13:51:10Z","updated_at":"2015-08-06T16:57:06Z","closed_at":"2015-08-06T16:57:06Z","body":"Okay, so up front this setup works:\r\n\r\n``` docker\r\nFROM ruby:2.2.2\r\n\r\nENV SOURCE \"/usr/src/app\"\r\n\r\nWORKDIR $SOURCE\r\n```\r\n\r\n``` yaml\r\nweb:\r\n  command: /usr/bin/foreman start\r\n  build: .\r\n  volumes:\r\n    - .:/usr/src/app\r\n  ports:\r\n   - \"3000:3000\"\r\n```\r\n\r\nHowever, I started to realize that I wanted to push more things into docker: `bower install`, `npm install`, `bundle install`, and `rake db:setup`.\r\n\r\nHowever these things require files to exist on the docker container before they're run! For `bower`, `npm`, and `bundle` it was easy: just use `COPY Gemfile $SOURCE/Gemfile` and things get copied over correctly. **I want to reiterate, `COPY source destination` works as intended.**\r\n\r\nThis \"solution\" doesn't work for `rake` tasks however, since the entire rails stack has to be present. Further more `COPY` is a build operation, meaning that changes to my (say) `config/application.rb` don't get pulled over, I need to rebuild to get the new source. So I decided to move my volume declaration out of `docker-compose.yml` and into `Dockerfile`. I couldn't get it to behave!\r\n\r\nFor reference, this does not seem to work:\r\n\r\n``` docker\r\nFROM ruby:2.2.2\r\n\r\nENV SOURCE \"/usr/src/app\"\r\n\r\nWORKDIR $SOURCE\r\nVOLUME .:$SOURCE\r\n```\r\n\r\n``` yaml\r\nweb:\r\n  command: /usr/bin/foreman start\r\n  build: .\r\n  ports:\r\n   - \"3000:3000\"\r\n```\r\n\r\nThe resulting container creates a `/usr/src/app` but it's empty.\r\n\r\nThis is strange to me since `-v` and `VOLUME` are supposed to be the same (according to docker documentation).\r\n\r\nNow I realize why this might be a complication with `boot2docker` being a layer between my filesystem and the containers. Since b2d mounts my `/Users` directory however I figured it would work fine.\r\n\r\nWhy the discrepancy? How do I fix it? If I can't use `.` as a source, how do I source while being idiomatic and not forcing other developers to overwrite their source?"},"comment":{"url":"https://api.github.com/repos/boot2docker/boot2docker/issues/comments/128441805","html_url":"https://github.com/boot2docker/boot2docker/issues/1021#issuecomment-128441805","issue_url":"https://api.github.com/repos/boot2docker/boot2docker/issues/1021","id":128441805,"user":{"login":"krainboltgreene","id":334809,"avatar_url":"https://avatars.githubusercontent.com/u/334809?v=3","gravatar_id":"","url":"https://api.github.com/users/krainboltgreene","html_url":"https://github.com/krainboltgreene","followers_url":"https://api.github.com/users/krainboltgreene/followers","following_url":"https://api.github.com/users/krainboltgreene/following{/other_user}","gists_url":"https://api.github.com/users/krainboltgreene/gists{/gist_id}","starred_url":"https://api.github.com/users/krainboltgreene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krainboltgreene/subscriptions","organizations_url":"https://api.github.com/users/krainboltgreene/orgs","repos_url":"https://api.github.com/users/krainboltgreene/repos","events_url":"https://api.github.com/users/krainboltgreene/events{/privacy}","received_events_url":"https://api.github.com/users/krainboltgreene/received_events","type":"User","site_admin":false},"created_at":"2015-08-06T16:57:06Z","updated_at":"2015-08-06T16:57:06Z","body":"Talked with a docker core maintainer (the person who worked on volumes), and apparently this is how it's \"intended\". `-v` and `VOLUME` don't have the same behavior sadly."}}