I am new to Laravel development, and I spent the last 5 hours trying to get a Laravel project up and running using Docker (which apparently is obligatory). Every single time I try to create a new Laravel project using the provided curl
cmd, it says Docker is not running although it is. Literally spent the last hour browsing the internet for possible solutions, but nothing works.
Why do I have to install Docker, Debian & co on my Windows 10 machine for Laravel development?
You don't need Docker, it just (arguably) simplifies your development experience. Docker is a containerization solution where people create images
that contain applications and packages which when deployed, provide an environment that meets their requirements. It's kind of similar to virtualization, only it works closer to the hardware so is more performant.
With Laravel the basic requirements are PHP
, MySQL/MariaDB
, and Apache/Nginx
. There are other packages people frequently use alongside Laravel such as Redis
, RabbitMQ
& Memcache
to name a few. Laravel Sail
provides a wrapper around the Docker commands for starting and stopping containers (instances of Docker images) and some pre-configured environments. Sail
currently provides images for PHP 7.4
and PHP 8
and Nginx
and a choice of RDBMS
and some other things like Redis
.
By using Sail
, you don't need to install and configure these things on your host system. You install Sail
then run a few commands to install the packages you want and away you go.
Aside from simplifying the development experience, another nice added benefit is that you can create Docker environments for development and use the same image for production so you can be confident there will be no deployment issues (or at least shouldn't be.).
Again, you don't have to use Docker with Laravel. You are not missing out on anything by not using it, you just need to install and configure your environment manually on your host.
So in your scenario, if you were to not use Sail
, you will need to install PHP
, Nginx
and either MySQL
or MariaDB
and Composer
at a minimum. Take a look at this LEMP
installation tutorial on how to go about and then watch the Laravel 8 from Scratch series (or at least the environment setup part) for things like Composer
.
If you want to use Laravel with the local server it's absolutely fine.
You can use the composer command rather than the docker command.
If you want to use the docker command, you must have to install the docker in your PC and keep it running.
Here is the composer command:
composer global require laravel/installer
To run this command, you need composer installed. Use this link to download and install composer: https://getcomposer.org/
Laravel official Link: https://laravel.com/docs/8.x#the-laravel-installer
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.