LARAVEL SAIL: OCI runtime exec failed: exec failed: unable to start container process: exec: "composer": executable file not found in $PATH: unknown
07:00 25 Sep 2022

I am quite new to Laravel even though I have already created several mini projects.

Today I tried to create a new Laravel project with Sail in the way that the documentation indicates

curl -s https://laravel.build/blade-components | bash

The application is created correctly, I raise the container with ./vendor/bin/sail up, I compile the styles with sail npm run dev, I run the migrations and everything is correct in the browser (localhost).

The problem comes when trying to install JetStream with the composer command

sail composer require laravel/jetstream

The error is:

OCI runtime exec failed: exec failed: unable to start container process: exec: "composer": executable file not found in $PATH: unknown

For some reason, it's like composer doesn't get installed to the project.

When I run sail, or sail npm (for example), it recognizes the commands and shows me the different actions available. I tried to run the composer command from sail's attach shell and it doesn't recognize it.

Executing task: docker exec -it 7b2cd6402559708130d9fdf7b8f8e8cbcd9ed47d524a77dd10cf2ee0068b5150 bash 

root@7b2cd6402559:/var/www/html# composer
bash: composer: command not found

Then I opened previous Laravel projects to test if the sail composer command worked and the same thing happens (it didn't before), so it's not a project-specific thing.

I would greatly appreciate your help! P.S.: sorry for my English, greetings from Argentina!

php laravel docker composer-php