Laravel Sail won’t build on Ubuntu 20.04 – groupadd: invalid group ID ‘sail’

I was trying to setup a laravel/sail with docker on the fresh ubuntu install.
After following this manual:

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


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can add this to .env file


Both values should be 1000, but you can also get them from bash

id -g <username>
id -u <username>

Method 2

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 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:

Method 3

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'

Method 4

The problem was with the composer itself. After re-installation and clearing docker images it started to build it up!

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x