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

eggplantSword's avatar

Using Docker existing projects

I'm struggling to get my windows computer to be able to run my Laravel projects, it's a never ending battle. My newest try has been Docker/Sail since my Homestead died a week ago and refused to work again.

Here is what I did step by step:

Now here is where I'm a bit lost and I haven't been able to more forward, I found this is the docs https://laravel.com/docs/10.x/sail#installing-composer-dependencies-for-existing-projects but in my case I don't have Sail installed on the projects either, so someone told me to try this

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 && composer require laravel/sail --dev && php artisan sail:install

now this kinda works in the sense that I don't get any errors but after finishing it doesn't install anything from composer and says

Package manifest generated successfully.
89 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Command 'composer' not found, but can be installed with:

sudo apt install composer

ok, now last time I did run that sudo apt install composer BUT after that I kept getting a php version mismatch so I uninstalled that Ubuntu since I didn't know what to do to fix it.

So here I am again, what am I supposed to do now?

I tried to have a teammate install and run php artisan sail:install and sail was already installed but the second command php artisan sail:install threw a bunch of errors I'm assuming because my teammate doesn't use docker/sail but homestead.

How can I run php artisan sail:install ?

edit:

I managed to run the php command and now if I try to run sail up I get these errors https://media.discordapp.net/attachments/1134566429065224264/1136012007376691311/image.png?width=1119&height=555

https://media.discordapp.net/attachments/1134566429065224264/1136012007649316915/image.png?width=1440&height=522

0 likes
10 replies
vincent15000's avatar

I have only read the beginning of your post.

Why do you absolutely want to use Docker ?

You can install Laragon and it works fine and let your Laravel application run on Windows.

https://laragon.org/

eggplantSword's avatar

@vincent15000 Well mainly because I was using Homestead and was recommended to move over to Docker/Sail since my Homestead died and I couldn't get it to work again.

I'm not against Laragon, actually I use it on my personal computer but for work we have more complex projects, for example we use Tenancy for Laravel that uses subdomains, I just wasn't sure if Laragon could make that work correctly.

1 like
eggplantSword's avatar

@vincent15000 Idk, I was just following the advice I got, to go with Sail. If this doesn't work I'll definitely look into Laragon.

I have managed to finally run ./vendor/bin/sail up, do you know what is the next part to setup the db?

1 like
JabatoForever's avatar

@msslgomez if u see the mysql image in the docker container then from the project folder run

./vendor/bin/sail shell

and then run

php artisan migrate 

an alternative would also be

./vendor/bin/sail artisan migrate
1 like
eggplantSword's avatar

@JabatoForever do I run this ./vendor/bin/sail shell after ./vendor/bin/sail up ?? I did try ./vendor/bin/sail artisan migrate but it didn't work.

This is the output https://media.discordapp.net/attachments/1136032482014277766/1136036431802937475/image.png?width=1440&height=376

This doesn't seem right but I'm completely new so idk what to expect, in the pic you can also see I tried running another command but that one never reacted and didn't do anything.

1 like
JabatoForever's avatar

Hi, @msslgomez Start the Docker container using ./vendor/bin/sail up Add the -d flag if you want to run Docker in detached mode. After the Docker container is running, you can execute Laravel Artisan commands in one of two ways:

  • enter the Docker container's shell using ./vendor/bin/sail shell and run your Artisan commands there.
  • run Artisan commands directly from outside the container using ./vendor/bin/sail artisan [command]. In case of failure, paste the docker-compose.yml file and the output of docker ps to investigate the issue. Remember, the shell process should remain running if not using the -d flag; closing the terminal without -d will also stop the container.
1 like

Please or to participate in this conversation.