Create your first Laravel Project on Docker using Laravel Sail

Chandresh
CS Code
Published in
2 min readFeb 22, 2021

There are multiple ways to develop and run Laravel project on your system but here is the easiest way to create your Laravel project on docker using Laravel Sail which is a light weight command line interface for interacting with Laravel’s docker configuration.

All you need to do is install docker on your system, you can use either Docker cli or Docker Desktop and rest of the thing are all taken care by Laravel Sail.

Before we start, if you want then you can also watch this tutorial.

Let’s Start!

To install Docker Desktop, Click here.

After Docker is installed and running, run the following command to create a new Laravel Project.

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

After your project is created, go inside your application directory and start Laravel Sail.

cd example-app./vendor/bin/sail up

Once done, You can access your application at http://localhost.

./vendor/bin/sail php — version./vendor/bin/sail node — version./vendor/bin/sail php artisan list

You can also create an alias for sail if you don’t want to type vendor/bin/sail repeatedly.

alias sail='bash vendor/bin/sail'

Then you can execute your commands like this:

sail php — versionsail node — versionsail php artisan list

To stop all your containers, you can type Ctrl+C or you can also use sail down command.

Hope you find this useful.

--

--