After successfully making WSL2 work with Docker Desktop (v3.1.0)
NAME STATE VERSION
* Ubuntu-20.04 Running 2
docker-desktop Running 2
docker-desktop-data Running 2
I followed steps from the Laravel Docs: https://laravel.com/docs/8.x#getting-started-on-windows but the error:
[ErrorException]
file_get_contents(): Read of 8192 bytes failed with errno=13 Permission denied
showed up, and i couldn't find the docker-compose.yml
file in the directory either, after running ./vendor/bin/sail up
:
ERROR:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml
This is probably a Linux permission problem. The safest way to fix it is to chown
the directory and make it owned by the same user / group as the php process is running under.
The default user is called sail: https://github.com/laravel/sail/blob/1.x/runtimes/8.0/Dockerfile#L46
And the group is read from a.env variable called WWWGROUP
So what you want to do is open your WSL2 console, cd to your project. And run
chown -R sail:<whatever your group from the env is WWWGROUP> .
.
means current directory.
Many beginners would do things like chmod 777
, however this is a bad practise .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.