DEV Community

Cover image for Running Laravel on Docker is really easy with Kool

Running Laravel on Docker is really easy with Kool

Daniel Polito on June 22, 2021

In just 3 simple steps, you can use Kool CLI's kool create command to start a new Laravel application running in a local Docker environment. Kool i...
Collapse
 
bobbyiliev profile image
Bobby Iliev

This is pretty cool. Does it work for production or is it manly for local development?

I've been using official Laravel Sail package which does a similar thing for local environments and it's been very good.

Collapse
 
fabriciojs profile image
Fabrício José Souza

The Docker/DockerCompose is meant mostly for local development, although you can (and we have done) just use it in production as well, but that is not advised.

We are in a closed beta phase testing a tool where you can very, very easily deploy your local Docker Compose setup to a Kool.dev managed Kubernetes cluster. It will be as simple as "kool deploy". Stay tuned and follow us here that we soon will be posting more about it.

Collapse
 
vladimirnikolic profile image
Vladimir Nikolic

Please dont take me wrong, had to ask.
You said:
" you can (and we have done) just use it in production as well, but that is not advised"
Why would you do something on production, business, source of incomes, etc.. if you are not recommending it?
I am really confused.
Why is not advised, what Are the reasons? You are using it. Please help me understand Fabricio

Thread Thread
 
fabriciojs profile image
Fabrício José Souza

Thanks for asking, indeed it came out a little confusing. Let me clarify:

What is not advised is to use the very same Docker Compose structure we use for local development, to a production deployment. We did that in the beginning for how easy it was... But when we talk about production we need to think about scaling/monitoring/observability/etc...

That is why for production we parse the Docker Compose local env to a Kubernetes namespace, where we are more provisioned and prepared to keep good care of production grade containers.

So Docker Compose is great for running a set of containers together, which helps a lot development of container based applications. But when we talk production, we will use those very same containers, but in a different orchestrator, to help us with the requirements of a production deployment.

Thread Thread
 
fabriciojs profile image
Fabrício José Souza

And just to add to it - Kool CLI will help you all the way for local development in multiple languages/microservices/frameworks...

To move all that to production, we are cooking what we call Kool Cloud for helping making any Docker Compose based local environment deployable to a Kubernetes cluster. That is the coming soon/stay tuned part of my initial answer all about.

Collapse
 
dbpolito profile image
Daniel Polito

Laravel Sail is indeed great, we do have some differences so i would love if you could try and give us your feedback, we also support different stacks (frameworks, languages) with the very same UX.

We already support / use kool images in production, if you take a look at our image: github.com/kool-dev/docker-php

As Fabricio said, we are also working on a premium feature called Kool Cloud but we plan to have proper documentation on how to use Kool on production with Docker, which is done but not documented yet.

If you're interested in learning more about it, please join our slack at kool.dev/slack and we can help you get started.

Collapse
 
leonklinke profile image
Leon Klinke

I've been using kool for months. It's an amazing tool to increase performance and security, it makes you life so much more easier =D

It fits perfectly in my project that uses: NodeJs(adonis) and ReactJs

Collapse
 
roniepetersondf profile image
Ronie Peterson

Thanks for this article.

Collapse
 
eduardonakatsuka profile image
Eduardo Nakatsuka

Pretty cool package, have used it several times for laravel and so far so good

Collapse
 
nkabz profile image
Nikolas

I've been working with Kool since the early stages and loved it from the beginning! :)
Such a great tool to simplify what a developer needs, and it is in constant development & improvement.

Highly recommend it!

Collapse
 
bessa3301 profile image
Bessa

Very Informative and useful! Kool is a powerful tool to accelerate development and focus on what matters the most, coding.

Collapse
 
andreruz profile image
Andre de Oliveira Ruz

I'm using, and this tool increases my productivity so much! Thanks, Kool team!

Collapse
 
wadecodez profile image
Wade Zimmerman

Does Kool work with WordPress and other PHP frameworks?

Collapse
 
fabriciojs profile image
Fabrício José Souza

Yes! We even have a preset to start a new wordpress project! Check out the doc here: kool.dev/docs/presets/wordpress

In case you wanna drop us a message on Slack, we wanna help more people getting up and running with Docker! kool.dev/slack

Collapse
 
g0d0 profile image
Godô • Edited

It's awesome tool to increase productivity. I don't worry more about the local environment. Perfect for beginners and advanced users.

Also following its development from the beginning and the improvement has been continuous and exponential.

Thanks Kool team!

Collapse
 
vladimirnikolic profile image
Vladimir Nikolic

Can you use this on existing laravel project?

Collapse
 
dbpolito profile image
Daniel Polito

Yes...

We need to improve in our docs, but instead of running kool create you will cd into your laravel project and run kool preset laravel, this will open the wizard and will create the files needed to start using it on your project.

The other steps are pretty much the same.

Collapse
 
cesramires profile image
Cesar Ramires

Really easy to use not only for Laravel, PHP, etc! I'm also using kool.dev for NextJS.

Collapse
 
andreslopezrm profile image
Andres Lopez

Great tool !!!!! 😃

Collapse
 
omenejoseph profile image
omenejoseph

What are the possibilities of running micro services that are all individually laravel instances with individual databases on one container here on kool? Because it seems it just serves directly from local host. Thanks

Collapse
 
dbpolito profile image
Daniel Polito

Well, you have a few possibilities here:

  1. First option and most recommended is separate containers, we posted some days ago a way of working with Multiple applications with Kool: dev.to/kooldev/use-kool-to-run-mul...

  2. If you want everything on the same container, this will require some knowledge of docker, where you should install kool on the parent folder of all projects you want to work together and customize the kooldev/php:8.0-nginx image, you can see how it's built here: github.com/kool-dev/docker-php/tre...

Customize the vhost to serve the different apps on different folders or hosts.