Skip to content

Sail is not working when using docker-desktop for Linux #548

@jurios

Description

@jurios
  • 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:

  1. Install docker engine and docker-desktop in a Linux system and run both.
  2. Switch the context to use docker engine running the following command: docker context use default
  3. 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
...
  1. Stop sail: sail down
  2. Change the context in order to use docker-desktop with docker context use desktop-linux
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions