-
Notifications
You must be signed in to change notification settings - Fork 507
Description
- Sail Version: 1.20.1
- Laravel Version: 9.51.0
- PHP Version: Using
sail
with 8.2 - Host operating system: Linux Ubuntu 22.04.1
Description:
This bug is reproducible in Linux. Not sure what happens on MacOS or Windows.
When I run sail
using the docker engine, the files in the container are assigned to sail/sail
.
The user/group is the expected one thus laravel.test
webserver is able to serve the files with no problem.
However, when run sail
using the desktop-linux
context (which is the context used by docker-desktop
), owner/group are not correctly set to sail/sail
.
Looks like volumes are handled a bit different when using docker-desktop
: https://docs.docker.com/desktop/faqs/linuxfaqs/#how-do-i-enable-file-sharing
As the owner/group have changed, the webserver is not able to serve the website:
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
Steps To Reproduce:
- Install
docker engine
anddocker-desktop
in a Linux system and run both. - Switch the context to use
docker engine
running the following command:docker context use default
- Run
sail
and check owner/group of the shared files in the container:
sail up -d
docker exec -it example-app-laravel.test-1 ls -l
You should see something like this:
drwxr-xr-x 7 sail sail 4096 Jan 31 15:05 app
-rwxr-xr-x 1 sail sail 1686 Jan 31 15:05 artisan
...
- Stop sail:
sail down
- Change the context in order to use
docker-desktop
withdocker context use desktop-linux
- And run the same commands
sail up -d
docker exec -it example-app-laravel.test-1 ls -l
That's the output:
drwxr-xr-x 7 root root 4096 Jan 31 15:05 app
-rwxr-xr-x 1 root root 1686 Jan 31 15:05 artisan
...
As you can see file's owner/group changed.
Solutions
Not sure. At the moment looks like avoid using docker desktop
in Linux and use docker engine
instead is a workaround.
Related: #459