Laravel is used to build web applications of any type you want. This framework is surprisingly fast, user-friendly, and very well documented. As you can learn from its official introduction,
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.
Docker, on the other hand, is a virtualization method that eliminates the “works on my machine” issues when cooperating on code with other developers. Due to the Docker’s slightly different approach to the virtualization architecture it’s also:
- faster and less resource-consuming than regular VM’s
- easier to set up and modify
- easy to reuse: you can pick an existing Docker image and install any missing libraries and packages (similar to class inheritance)
- shareable: you can push images to Docker registries and pull them on other machines, just like you push and pull code from Git
Dockerizing Laravel application
In this guide we’ll use a simple calculator written with the Laravel framework. Make sure to fork github.com/buddy-works/laravel-first-steps from our GitHub profile and run it with
php artisan serve.
Please mind we use `php artisan serve` for test purposes only. For production you should use an image with Apache or Nginx.
The calculator should be launched in a Docker container. What we need is a Dockerfile with the description of the Docker image that will run the Docker container. Think it’s complicated? Don’t worry, we’ll walk you through the process and describe everything in detail.
The full version of the guide is available for free on our website: Laravel in Docker.