Now Running Laravel On Docker Is Truly Quite Easy With The Kool Tool - Simplior

Now Running Laravel On Docker Is Truly Quite Easy With The Kool Tool

In simply three easy steps, For a start a new Laravel application running in a local docket environment, you can use Kool CLI’s kool create command. As an open-source dev tool “Kool” that makes using Docker for local development a very much easier.

You need to install Docker & Kool CLI, Before you begin if you haven’t done it already.

(1) Build a new Laravel application

$ kool create laravel my-project

This command may require a little while to finish while “Composer” downloads Laravel’s vendor dependencies. “kool create” automatically runs the “kool preset Laravel” command after installing Laravel. It helps you set up your Application development environment with the use of an interactive wizard.

PHP

PHP_Laravel-Simplior

Database

Database_Laravel-Simplior

Cache

Cache_Laravel-Simplior

Package Manager

Package_Manager_Laravel - Simplior

After picking your choices, the newest version of Laravel will be installed and available for you in your “my-project” folder, along with your new “kool” environment.

Initializing_Laravel - Simplior

Move into your latest Laravel project:

$ cd my-project

Now, “kool preset” this command automatic generate the following configuration files and added them into your project, which you can change or extend.

+docker-compose.yml
+kool.yml

(2) Update .env.example

Onward we require to make some tweaks to the default “.env.example” document that ships with Laravel in order to match the services in your “docker-compose.yml” file/document. For example, here we have to change the hosts from localhost to the appropriate service container name, which are obtainable from within Docker.

  • Database Services

MySQL 5.7 and 8.0 / MariaDB 10.5

-DB_HOST=127.0.0.1
+DB_HOST=database

PostgreSQL 13.0

-DB_CONNECTION=mysql
+DB_CONNECTION=pgsql

-DB_HOST=127.0.0.1
+DB_HOST=database

-DB_PORT=3306
+DB_PORT=5432

  • Cache Services

Redis

-REDIS_HOST=127.0.0.1
+REDIS_HOST=cache

Memcached

-MEMCACHED_HOST=127.0.0.1+MEMCACHED_HOST=cache
Convinces with Laravel? We are here to help you build high-performance Laravel Web App!

(3) Run kool run setup

Now, first time using the setup script in your kool.yml file, spin up your local environment.

$ kool run setup

Note:- if you are use this command first time, then Docker may require to download all the container images that are being used. So, for this process it’ll taking some time.

You can use your new Laravel app at http://localhost, after kool run setup has finished.

koolRunSetup-Simplior
localhost_Laravel - Simplior
Learn More About kool:
  • Learn more further regarding using Kool with Laravel, Read the docs for our Laravel Preset
  • To learn more extra regarding the Kool open source project, Go to kool.dev

Being the Top Laravel Development Company in India and USA, Simplior Technologies is building extremely secure, Flexible, Robust & Bug-free Web Apps. We follow coding standard, Our code is reusable, clean and well commented which help you understand very well in the later phase.

Ref: dev.to

Post Form

  • Expand Your Digital Horizons With Us.

    Start a new project or take an existing one to the next level. Get in touch to start small, scale-up, and go Agile.