-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm won't run install after USER switch but works with RUN su instead #4614
Comments
I think something changed with respect to permissions of mounted volumes in 0.9. I worked around this by using chown on all the directories npm tries to install to |
This isn't a bug. "USER someuser" is only used wen running the image, not when building or running anything during a build. http://docs.docker.io/en/latest/reference/builder/#user clearly states that:
This means |
For what its worth, I think I have been seeing different behavior with the docker build using the USER immediately. This is probably because RUN is in fact running an image in an intermediate container. It would make sense for docker to use USER immediately because it can just be placed at the end of the Dockerfile, but the problem to be worked out is then the proper behavior when building on top of an image that specifies a USER. I find it very convenient to install as a user other than root sometimes. Some documentation on techniques for this would be helpful. |
@unclejack this is not true, the docs state that "The USER instruction sets the user name or UID to use when running the image and for any following RUN directives." So what this ticket describes should work, according to the docs! |
getting errors running npm install after switching users within the Dockerfile:
gives me the following error for every node module:
However, if I replace the 'USER nonroot' line with 'RUN /bin/su nonroot' everything is copacetic.
The text was updated successfully, but these errors were encountered: