Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissions seemed to be borked under completely new Docker Desktop installation #754

Open
martinbean opened this issue Nov 18, 2024 · 6 comments

Comments

@martinbean
Copy link

martinbean commented Nov 18, 2024

Sail Version

1.38.0

Laravel Version

11.32.0

PHP Version

8.3.13

Operating System

macOS

OS Version

14.6.1

Description

Recently, I’ve started getting the following warning whenever I run any composer commands inside a Sail container:

The repository at "/var/www/html" does not have the correct ownership and git refuses to use it:

fatal: detected dubious ownership in repository at '/var/www/html'
To add an exception for this directory, call:

	git config --global --add safe.directory /var/www/html

I have reset Docker Desktop to factory defaults (from the “Troubleshoot” menu). I’ve even completely uninstalled Docker Desktop and installed it afresh, but as soon as I run sail build, sail up -d, and then access the running instance using sail shell, I get the warning above the first time I run a Composer command, i.e. composer update

If I run ls -al, I notice all the files and directories inside the /var/www/html directory seem to be owned by the user sail and group dialout, but the directory itself is owned by the user root and group root:

drwxr-xr-x 32 root root      1024 Nov 18 17:13 .
drwxr-xr-x  3 root root      4096 Nov 18 17:20 ..
-rw-r--r--  1 sail dialout    294 Nov 18 16:12 .editorconfig
-rw-r--r--  1 sail dialout    745 Nov 18 16:20 .env
-rw-r--r--  1 sail dialout    694 Nov 18 16:20 .env.example
drwxr-xr-x  9 sail dialout    288 Nov 18 15:58 .git
-rw-r--r--  1 sail dialout    186 Oct 21 13:59 .gitattributes
drwxr-xr-x  3 sail dialout     96 Nov 18 17:09 .github
-rw-r--r--  1 sail dialout    248 Nov 18 17:11 .gitignore
# And so on...

Steps To Reproduce

  1. Run sail build --no-cache
  2. Run sail up -d
  3. Run sail shell
  4. Run composer update from inside the Sail container
@martinbean
Copy link
Author

martinbean commented Nov 21, 2024

Furthermore, it seems this breaks serving projects via Sail. I just get a 500 error when trying to load any page, and have traced it to the server.php script in the Laravel framework. It fails on this line:

https://github.com/laravel/framework/blob/5657af6fd8e760982bca85db6e2d01cddc0e2530/src/Illuminate/Foundation/resources/server.php#L3

The call to getcwd just returns false, and then the server script tries to require /index.php on line 23, which doesn’t exist. I’m guessing the getcwd function is returning false because of the file permissions issue.

@Im-Fran
Copy link

Im-Fran commented Nov 21, 2024

I'm currently having the same warning regarding the permissions of the /var/www/html folder, but up until now my project is still working Im-Fran/api.rubybox.cl under the branch feat/pruebas-y-paquetes.

I've tried removing everything from my docker, volumes, containers, builds, and building from 0 without cache (after restarting my mac) but I'm still facing this warning.

@IP-Developer
Copy link

Can confirm this issue is present in v1.38.0. Downgrading to v1.37.1 and rebuilding fixed it.

@Im-Fran
Copy link

Im-Fran commented Dec 2, 2024

Ok, I can confirm that now it works with the latest version, no idea what happened but I purged all my data from docker (this will remove all containers, images and volumes).

After removing the vendor folder then re-install using the docker run command (docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/var/www/html" -w /var/www/html laravelsail/php83-composer:latest composer install --ignore-platform-reqs) then re-build with sail build --no-cache and now it works.

@francoism90
Copy link
Contributor

francoism90 commented Dec 6, 2024

Also having the same issue, which causes composer caches to be out of dated.

@Im-Fran This works, but unfortunately this issue happens randomly again. Is it a Docker issue?

This is also on MacOS btw.

@Im-Fran
Copy link

Im-Fran commented Dec 15, 2024

I don't really know, maybe it's a file permission issue? I haven't seen the error really lately, but if I get the same error I'll try to investigate what caused it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants