{"action":"created","issue":{"url":"https://api.github.com/repos/npm/npm/issues/8836","labels_url":"https://api.github.com/repos/npm/npm/issues/8836/labels{/name}","comments_url":"https://api.github.com/repos/npm/npm/issues/8836/comments","events_url":"https://api.github.com/repos/npm/npm/issues/8836/events","html_url":"https://github.com/npm/npm/issues/8836","id":93310309,"number":8836,"title":"Speeding up `npm install` in docker","user":{"login":"olalonde","id":416585,"avatar_url":"https://avatars.githubusercontent.com/u/416585?v=3","gravatar_id":"","url":"https://api.github.com/users/olalonde","html_url":"https://github.com/olalonde","followers_url":"https://api.github.com/users/olalonde/followers","following_url":"https://api.github.com/users/olalonde/following{/other_user}","gists_url":"https://api.github.com/users/olalonde/gists{/gist_id}","starred_url":"https://api.github.com/users/olalonde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olalonde/subscriptions","organizations_url":"https://api.github.com/users/olalonde/orgs","repos_url":"https://api.github.com/users/olalonde/repos","events_url":"https://api.github.com/users/olalonde/events{/privacy}","received_events_url":"https://api.github.com/users/olalonde/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/npm/npm/labels/support","name":"support","color":"FF91AF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-06T15:39:32Z","updated_at":"2015-10-22T20:24:48Z","closed_at":null,"body":"I'm using a `Dockerfile.dev` file for Node.js development and am using the following \"trick\" to only `npm install` when `package.json` is modified:\r\n\r\n```\r\nCOPY package.json /src/\r\nRUN npm install --unsafe-perm\r\nCOPY . /src\r\n```\r\n\r\nHowever, as I frequently install new modules and the `npm install` is quite slow, this is not good enough. I've tried mounting my local `node_modules` as a mounted volume but it seems `npm install` installs everything from scratch regardless of whether there are already installed modules in `node_modules/`. Is this correct? in this case, are there any flags or commands I can use to only `npm install` modules which aren't already present in `node_modules/`? Would mounting `./docker_npm_cache:/root/.npm` in the Docker container be another suitable option?"},"comment":{"url":"https://api.github.com/repos/npm/npm/issues/comments/150346392","html_url":"https://github.com/npm/npm/issues/8836#issuecomment-150346392","issue_url":"https://api.github.com/repos/npm/npm/issues/8836","id":150346392,"user":{"login":"brownoxford","id":755209,"avatar_url":"https://avatars.githubusercontent.com/u/755209?v=3","gravatar_id":"","url":"https://api.github.com/users/brownoxford","html_url":"https://github.com/brownoxford","followers_url":"https://api.github.com/users/brownoxford/followers","following_url":"https://api.github.com/users/brownoxford/following{/other_user}","gists_url":"https://api.github.com/users/brownoxford/gists{/gist_id}","starred_url":"https://api.github.com/users/brownoxford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brownoxford/subscriptions","organizations_url":"https://api.github.com/users/brownoxford/orgs","repos_url":"https://api.github.com/users/brownoxford/repos","events_url":"https://api.github.com/users/brownoxford/events{/privacy}","received_events_url":"https://api.github.com/users/brownoxford/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T20:24:48Z","updated_at":"2015-10-22T20:24:48Z","body":"I'm seeing the same issue being reported by @olalonde, I'm just using docker as a container run npm install as part of a build process for my app:\r\n\r\n```bash\r\ndocker run --rm -v $(pwd):/app -w /app node:4.2.1 npm install\r\n```\r\n\r\nNo matter what I do this keeps installing everything from scratch... This image provides npm v2.14.7 and node v4.2.1.\r\n"}}