Sail image build stops at groupadd with an invalid group ID
groupadd: invalid group ID 'sail'Short answer
The Sail Dockerfile runs groupadd with the WWWGROUP build argument. If that argument is empty, groupadd receives the word sail where it expects a number and stops. WWWGROUP is normally filled in by the sail script, so the build fails when compose runs without it or when compose.yaml no longer passes it.
Fix it fast
1Find out which cause you have
Print the group id the sail script would pass, then build through the script instead of calling docker compose yourself.
id -g ./vendor/bin/sail build --no-cache2Match what you see, then jump to its fix
- 1
The build works with ./vendor/bin/sail up but fails with docker compose up --build, from an IDE button, a CI job or a Docker GUI.Docker Compose was started without the sail scriptFix - 2
WWWGROUP appears in no build.args block of the laravel.test service.compose.yaml no longer passes WWWGROUP to the buildFix
- 1
What does the error look like?
groupadd: invalid group ID 'sail'The sail build works through ./vendor/bin/sail but not through plain docker compose
Cause 1 of 2
Docker Compose was started without the sail script
1Check
The sail script exports WWWGROUP from the current user's primary group when it is not already set. A plain docker compose call skips that export, so the build argument is empty and the Dockerfile line groupadd --force -g $WWWGROUP sail becomes groupadd --force -g sail.
echo "WWWGROUP=[$WWWGROUP]"
grep -n "WWWGROUP" compose.yaml2Fix
Run the build through the sail script. If you must call compose yourself, export the same values first.
export WWWUSER=$(id -u)
export WWWGROUP=$(id -g)
docker compose build --no-cache3Verify
The build finishes and the containers start.
./vendor/bin/sail up -dConfirmed by raw.githubusercontent.com
Cause 2 of 2
compose.yaml no longer passes WWWGROUP to the build
1Check
The Laravel docs show WWWGROUP as a build argument of the laravel.test service. After a hand edit, a merge or an old compose.yaml copied from another project, that line may be missing.
grep -n -B3 -A6 "build:" compose.yaml2Fix
Put the argument back under the build section of laravel.test, or regenerate the file.
build:
context: ./vendor/laravel/sail/runtimes/8.4
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'3Verify
Rebuild without the layer cache, as the Sail docs describe.
docker compose down -v
./vendor/bin/sail build --no-cacheConfirmed by laravel.com
How do I stop it coming back?
- Start Sail with ./vendor/bin/sail (or a shell alias for it) so WWWGROUP and WWWUSER are always set.
- If a tool has to run docker compose for you, set WWWUSER and WWWGROUP in its environment.
- Keep compose.yaml changes small and review the build.args block after every merge.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
- Spotless LaundryAn on-demand laundry app: Flutter on a Laravel back end, with Firebase for live updates.
Related fixes
Back end
sail up fails because Docker cannot find the project's compose file
no configuration file provided: not found
Sail is a thin wrapper around Docker Compose, and Compose found no compose file to read.
3 causes, each with a fixBack end
sail up fails with a permission error
WARNING: Error loading config file: /home/user/.docker/config.json - stat /home/user/.docker/config.json: permission denied
A permission error from sail up has three documented sources on Linux: Docker Desktop is using the wrong context, files inside the container are not writable by the container user, or Docker's own config folder is owned by root from an earlier sudo run.
3 causes, each with a fixBack end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
.NET in Docker cannot load libldap for LDAP or Active Directory
Unable to load shared library 'libldap-2.5.so.0' or one of its dependencies
On Linux, .NET's LDAP code loads the OpenLDAP library at run time, and the .NET images do not ship it.
2 causes, each with a fixBack end
Why a Filament panel feels slow on a Laravel server
The panel is fast on a small demo and slow once there are many resources, pages and widgets
A slow Filament panel on a server is most often running without the production caches.
3 causes, each with a fix