I cloned an existing Laravel project from git which was dockerized with Sail. As vendor is in the .gitignore, I need to rebuild it before I can use Sail to run my app. Acording to the Laravel doc ( https://laravel.com/docs/8.x/sail#installing-composer-dependencies-for-existing-projects ) i need to get my dependencies using this command.
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs
Problem is both cmd and powershell seem to struggle with the $'s, it seams that they expect an applet name, and I can't manage to run this. What am I missing ?
The error I am getting with PS is
id : The term "id" is not recognized as the name of a cmdlet, function, script file or operable program.
In cmd, i got
docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed.
I also tried with git bash and got
docker: invalid reference format: repository name must be lowercase.
Only execute the command in the WSL2 Distribution (as example, Ubuntu)
First, Open the wsl console from PowerShell pointing the project folder
wsl -d ubuntu
And then execute the docker command for execute Laravel sail
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs
I recommend check your php version for available laravel sail compatibility
When using the laravelsail/phpXX-composer image, you should use the same version of PHP that you plan to use for your application (74, 80, or 81).
Font: Laravel Sail
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.