Running existing laravel project with laravel sail and docker
I want to open an existing laravel project with laravel sail. But while following the steps in the laravel sail documentation I get an error[ Could not open input file: artisan] when I run [php artisan sail:install]. The project folder does not contain artisan and I have tried adding this manually but I get other errors.
You need to have php and composer to install project packages including sail. If you don't have those installed in your machine, Which I suppose, you should do the following.
Run your docker composer docker compose up -d
Run docker compose run [your_php_service_name] php composer install
Now you can kill your container docker compose down
Then use sail normally vendor/bin/sail up -d
The is according to normal Laravel setup like creating .env file and running migrations etc.
...
@Sinnbeck I got this error [Composer could not find a composer.json file in /app
To initialize a project, please create a composer.json file. See//getcomposer.org/basic-usage]
I checked the website but it is a bit confusing. Any help will be appreciated
@MohamedTammam hello I have a question when I'm running the docker and add a phpmyadmin container in the docker yml the docker is not detecting the database credentials in my .env, that's why i can't open the phpmyadmin. Can you help me with that one? Thank you
@charleskwakye Laravel has came with artisan for as long as I can remember, so this sounds like you either have an incomplete repository, trying to run artisan from the wrong directory, or just doing something else wrong.
@martinbean my mates were able to run it with homestead but you can take a quick look at it [//github.com/pverhaert/learn_php8]. Any help will be well appreciated.
Ok so I saw this in the laravel documentation
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
and I used it. It was successful. But now I don't know what to do next. composer require laravel/sail --dev doesn't work. I did docker run composer require laravel/sail --dev and it ran and installed stuff but I still can't run vendor/bin sail anything, its instead trying to access the php stored on my windows system (I'm working in the WSL Ubuntu environment)