I'm getting an Invalid group ID sail error on sail up (alias has been created so I don't need to use ./vendor/bin/sail up
anymore).
groupadd: invalid group ID 'sail'
ERROR: Service 'laravel.test' failed to build : The command '/bin/sh -c groupadd --force -g $WWWGROUP sail' returned a non-zero code: 3
I'm creating a new laravel project using docker and sail, i'm on Windows 10, I have enabled WSL 2 and all that was required in the docs, but after I create the laravel project in the ubuntu shell (Ubuntu 20.04), and build sail using the following commands
Build Error ( Sail up / Sail Build ): "gpg: keyserver receive failed: Server indicated a failure." #383 Build Error ( Sail up / Sail Build ): "gpg: keyserver receive failed: Server indicated a failure." #383 PHP Version: 8.1.
Run the command ./vendor/bin/sail up without the "-d" and show what appears. How are you creating your containers? Are you using docker-compose? There's probably an error happening in your container (s) and they are not created. So since you have no containers running, sail shell also doesn't work.
You can add this to .env file
WWWGROUP=1000
WWWUSER=1000
Both values should be 1000, but you can also get them from bash
id -g <username>
id -u <username>
You can solve this by just run this, before making docker-compose up
:
export APP_SERVICE=${APP_SERVICE:-"laravel.test"}
export DB_PORT=${DB_PORT:-3306}
export WWWUSER=${WWWUSER:-$UID}
export WWWGROUP=${WWWGROUP:-$(id -g)}
This is something that sail do every time you run a command with it, but when you run docker-compose directly you need to do it before.
You can see this here: https://github.com/laravel/sail/blob/1.x/bin/sail#L21
I choose to go into the bash of the docker container and 'chown' all the files in www/html/* to 'sail'
First to enter bash for sail.
sail bash
or ./vendor/bin/sail
if you didn't set up your alias.
Then you should be in the web root /var/www/html
chown -R sail .
That way, you keep the permisions the same as Laravel intended.
This happens if you run docker-compose up
, if you run sail up
it will work as intended.
You might need to configure the alias first:
alias sail='bash vendor/bin/sail'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With