-
Notifications
You must be signed in to change notification settings - Fork 108
npm throws Operation not permitted #17
Comments
hm I don't know why The consequence of this is that you aren't writing to the NFS share as root, and you typically won't have permission to chown files. Ideally, I'd love to be able to configure the NFS share to just ignore chown commands, like virtualbox built-in file shares do, but that isn't possible without modifications to the NFS server code. As far as your specific problem, is the I wouldn't be totally opposed to a configuration setting to let you choose whether dinghy enables root squashing or not, since both have their advantages. |
Hey @codekitchen thanks a lot for the heads up! I'm going to try changing the container user later and report back to you. |
Had the exact same problem running wercker, as I don't know how to configure it to not run as root inside the box, I have added a new step right before # NOTE: you might want to adjust the uid and gid values for your user
- script:
name: downgrade to mac user
code: |
useradd -u 501 -g 20 wercker
mkdir /home/wercker
/usr/bin/sudo -u wercker -s
export HOME=/home/wercker |
@haggen I'm going to close this, let me know of you're still hitting issues. |
@haggen I actually just hit a similar issue and wanted to share my solution. I have a nodejs app. I run it in a nginx container as it is just static site code built with nodjs. Because of this, developers can't just attach to the container and run Well, I run a separate container that is the official
I don't want to have to mess around with starting a container, mounting the repo, adding users/changing permissions, I want it automated! So this is what I came up with:
the first the second
This essentially is a containerized way of running commands so you don't need to install something like nodejs and npm on your local. You could take it one step further and use the Hope this can help someone |
This still does appear to be an issue. I worked around it by doing something like the following:
|
Switching user in the Dockerfile to a non-root user fixed it for me. |
@ryanmt How were you able to switch the user to a non-root user in the Dockerfile? |
@MrMMorriss I attempted that, but I'm now getting an even uglier exit than before. Still getting 'chown permission denied, Please try running as root' on npm install |
@Skilgarriff |
@ryanmt Turns out it was an issue with maproot. Dinghy does not map the root to 0 which causes some issues when trying to run any privileged command when trying to use that command on Volumes mounted with NFS. |
More background on this issue: docker/machine#1817 I'm specifically hitting this issue ATM with npm and it's looking like I'm going to have to use virtual box ... ;-( |
There's a comment here: npm/npm#3565 (comment) showing a nice way to overcome that - you can make chmod do nothing by using LD_PRELOAD. You can do it for the entire container in Dockerfile. First make sure you've gcc installed, and then add:
This simply makes chmod think it actually did something and succeed, so npm is all happy and confident it did a good job. You can also do it just for one command - just call npm install this way (again, you need gcc):
|
This uses a bash script as entrypoint that tricks the chown command so it will not throw 'operation not permitted' errors on nfs shares. @see codekitchen/dinghy#17
This is driving me nuts. In our dev environments, my team mounts their home folder to /root due to needing access to the NPM login token, AWS credentials, shared NPM cache, etc stored there. This worked well with docker implementations where root took ownership of new files (we've used dlite with success in the past, but lack of maintenance is making that one tough to use now). Under dinghy's model of setting root to use the executing user/group's access levels, I get this every time I NPM install, even if I delete ~/.npm first:
So I did a code-dive and discovered the
After a ...but my in-container
I really, really do not want to do the chown hack mentioned above if there's an nfs configuration that can restore the old functionality. Any idea why my solution didn't take care of this? EDIT: Neeeevermind. Rather than |
I'm using the
which was giving me that error. I fixed it setting the user to someone different than root, as follows:
(The |
Thank you so much! This helped me solve this problem as well! |
Using dinghy, when I try to
npm install
something, it complains:It used to work well on boot2docker, even when using nfs.
The text was updated successfully, but these errors were encountered: