-
Notifications
You must be signed in to change notification settings - Fork 24
[Windows/WSL2] Permission issue on nitro create / nitro composer install #280
Comments
For Windows, you will encounter permission issues because of the way Docker and WSL integration is. It's actually a WSL/Docker level problem not specific to Nitro as you'll encounter the same issues with php-fpm containers with Docker generally. The quickest way to resolve is to do https://craftcms.com/docs/nitro/2.x/windows.html#permissions-and-manual-setup-steps In your case the composer process within the container cannot write to the |
Thanks. |
@umkasanki can you provide the output of |
How was the |
@jasonmccallister |
Thank you, I will look into the best way to resolve this going forward. For now, you can run |
Thanks |
FWIW, I'm running into the same issue using Craft Nitro on Ubuntu. The group and owner for all created files is For me, having Nitro make the permissions "just work" would be an amazing win. |
Additional workaround comment. then updated the hosts file using administrator windows cmd to copy the nitro hosts content
I could now access the Craft UI finally as intended. |
I have this also and I'm on linux desktop, not WSL. |
Hi we also have this issue with linux desktop, talked to a colleague who worked on https://github.com/allaboutapps/go-starter where they had a similar issue. They worked around the problem by setting a specific user https://github.com/allaboutapps/go-starter/blob/master/Dockerfile#L134 Not sure if this is the same root cause of the problem, but this article might summarize the issues around it https://jtreminio.com/blog/running-docker-containers-as-current-host-user/ |
Yes, it is due to the UID/GUID being 1000 which is www-data, but the host will be a username like Running chmod 777 basically makes any user be able to read/write any file, but the problem is when directories or files like composer.lock don't exist initially from a project setup. Doing chmod 777 on ephemeral locations i.e. storage is fine, but a whole project is bad idea. I think the only way is for the UID and GID to be the same as the host which I believe @jasonmccallister was looking into. |
@aloco we have pushed a change that resolves this for linux users, we will be verifying today to make sure everything is good to go so it can go out with the next release. What @jamesmacwhite mentioned is part of the resolution, we grab the user information dynamically on Linux and tell the container to connect/execute as that host user https://github.com/craftcms/nitro/blob/develop/command/ssh/ssh_linux.go#L186. It does create some strange behavior, since things like |
Just released 2.0.7 with better support on Linux and WSL machines. |
Description
I get an error when trying to execute
nitro create
ornitro composer install
.Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: