Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chibs's avatar
Level 6

Pulling sail project to a computer with no local php / composer installed

When you create a Laravel Sail project using

curl -s https://laravel.build/example-app | bash

by default, vendor is not in version control (i.e. it's in gitignore)

so when you pull this project to another computer that has no PHP or Composer installed, you cant run 'sail' command because there is no vendor folder.

bash: vendor/bin/sail: No such file or directory

I thought the whole point of Docker and Sail was so we can use containers on environments with no local setup required.

Anybody got an idea how to run the sail project like this?

0 likes
15 replies
dalpatsingh's avatar

@chibs this will only run composer stuff but how to run php artisan sail:install if PHP is not installed.

Sinnbeck's avatar

@dalpatsingh you would need to run it inside the container, which might not be possible

sail artisan sail:install
martinbean's avatar

@kokoshneta Well, that’s the point of a containerised environment, innit?

@sinnbeck You can install the Composer dependencies using an on-demand Docker container like in the accepted answer. I actually do this myself by creating a simple shell script with that command and then a Makefile that runs it. It means someone can clone my repo and just run make install to get set up without needing Composer or PHP on their machine.

Sinnbeck's avatar

@martinbean yeah I know. I use it to install laravel in my own guide https://sinnbeck.dev/posts/using-lando-to-run-laravel-in-docker

My point was that I assumed the sail:install command would create the sail executable. So here you well need to use a second docker command to run artisan and install it. Using the sail tools wouldn't be possible to use directly

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v $(pwd):/opt \
    -w /opt \
    laravelsail/php80-composer:latest \
    php artisan sail:install 
1 like
kokoshneta's avatar

@martinbean I’ve never really used containerised environments, but my understanding is that even in those, PHP must still be installed in the image. How would anything be parsed in Laravel if there’s no PHP installation anywhere to parse it?

Edit: I assumed that, since running php artisan … commands would be entirely parallel to running the composer command in the accepted self-answer, the follow-up question must be about cases where there’s no PHP in the container. Rereading, perhaps it’s not as obvious as I’d read it, so I may have misinterpreted the follow-up.

martinbean's avatar

@kokoshneta Yes, but the PHP installation lives in an image and not on your machine. So you pipe your PHP commands to the image that contains PHP to be executed, rather than running them directly on your computer.

lsblsb's avatar

@chibs thanks a lot! did it previously, by creating a new laravel project and copying the vendor folder...

1 like
ryanrapini's avatar

@chibs Anyone know how to access private repositories in this docker instance? it crashes for me because my repo has private github urls in it.

XedinUnknown's avatar

@chibs this doesn't work if you've got e.g. platform requirements, such as PHP extensions, that are not included in the laravelsail/php80-composer image. Which is most of your specific platform requirements.

XedinUnknown's avatar

Here's what I did:

  1. Use the accepted answer, but add --ignore-platform-reqs to composer install. This will install Sail, create the vendor dir, etc.
  2. Use Sail to ensure deps are installed at their correct versions by running vendor/bin/sail composer install.
myosotisgit's avatar

Here is an interesting way to do it. It doesnt really matter if you start from scratch or if you have an existing project...

Clone the laravel git repo

git clone <url to Laravel Git repo>
cd laravel-app

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"

Configure laravel

cp .env.example to .env
docker run --rm \
 -u "$(id -u):$(id -g)" \
 -v "$(pwd):/var/www/html" \
 -w /var/www/html \
 laravelsail/php83-composer:latest \
 php artisan key:generate"

Now install sail

docker run --rm \
 -u "$(id -u):$(id -g)" \
 -v "$(pwd):/var/www/html" \
 -w /var/www/html \
 laravelsail/php83-composer:latest \
 php artisan sail:install"
2 likes

Please or to participate in this conversation.