Skip to content
Start » Web development » Laradock – Docker Containers for Your PHP and Laravel Development – Introduction

Laradock – Docker Containers for Your PHP and Laravel Development – Introduction

This entry is part 1 of 3 in the series Laradock - Tutorial

Laradock is a complete web development environment for Docker, which was born to support the development of Laravel systems and currently provides containers for different situations for development with PHP.

It supports a variety of common services, all pre-configured to provide a PHP development environment, Laravel, WordPress, Joomla, Drupal, CakePHP, among others, and totally ready.

In this introductory article you will get an overview of the project and a quick setup. To go deeper into usage and settings, access the tutorials:

Laradock Resources

  • Easy choice between PHP versions: 8.0, 7.4, 7.3, 7.2, 7.1, 5.6, 5.3 … (and above)
  • Simple choice of database engine: MySQL, Postgres, MariaDB, MongoDB and more
  • Running your own stack: Memcached, HHVM, RabbitMQ…
  • Each software runs in its own container: PHP-FPM, NGINX, PHP-CLI…
  • Easy to customize any container, with simple edits to the Dockerfile configuration file.
  • All images extend from an official base image – Trusted base images.
  • NGINX preconfigured to host any code in your root directory.
  • Possibility to use Laradock per project or a single Laradock for all projects.
  • Easy to install/remove software in Containers using environment variables.
  • Clean and well-structured Dockerfiles configuration files.
  • The latest version of the Docker Compose file (docker-compose).
  • Transparent, visible and editable configuration.
  • Quick image builds.

Laradock Quick Setup for PHP Laravel

Quick overview of how simple it is to configure our PHP, NGINX, MySQL, Redis and Composer development stack to run a Laravel project:

1 – Clone Laradock inside your PHP project:

$ git clone https://github.com/Laradock/laradock.git

2 – Access the folder laradock and rename the file.env.example for .env.

$ cd laradock $ cp .env.example .env

3 – Run your containers:

$ docker-compose up -d nginx mysql phpmyadmin redis workspace 

4 – Open the file .env of your Laravel project and set the following:

DB_HOST=mysql REDIS_HOST=redis QUEUE_HOST=beanstalkd

5 – Open your browser and visit localhost: http://localhost.

That's it, your environment is configured and running a Mysql server with PHP, NGinx and Redis.

You can choose which tools to install in your workspace container and other containers, from the file .env.

If you modify the file docker-compose.yml, .env or any dockerfile, it must rebuild its containers for the changes to take effect on the running instance.

Supported services, libraries and packages

Laradock follows the principle of “separation of interests” (separation of concerns) therefore runs each software in its own Docker Container.

You can turn on/off as many instances as you like without worrying about settings.

To run a container chosen from the list below, run the following command:

$ docker-compose up -d {container-name} 

The container name {container-name} is the same as the name of the service/software folder you want to upload to the container.

For example, to run the “PHP FPM” container, use the name “php-fpm”.

The following is a list of supported software and services at the time this article was written:

web servers

  • NGINX
  • Apache2
  • caddy

load balancers

  • HAProxy
  • traefik

PHP compilers

  • PHP FPM
  • HHVM

Database Management Systems

  • MySQL
  • PostgreSQL
  • PostGIS
  • MariaDB
  • percona
  • MSSQL
  • MongoDB
    • MongoDB Web UI
  • Neo4j
  • CouchDB
  • RethinkDB
  • Cassandra

Database management applications (clients)

  • PHPMyAdmin
  • Administrator
  • PgAdmin

caching mechanisms

  • redis
    • Redis Web UI
    • Redis cluster
  • memcached
  • aerospike
  • Varnish

Message brokers (Message managers)

  • RabbitMQ
    • RabbitMQ Admin Console
  • Beanstalkd
    • Beanstalkd Admin Console
  • Eclipse Mosquito
  • PHP Worker
  • Laravel Horizon
  • gearman
  • Amazon Simple Queue Service

email servers

  • mailu
  • MailCatcher
  • mailhog
  • MailDev

Log Management

  • GrayLog

Tests

  • selenium

monitoring

  • grafana
  • NetData

search engines

  • ElasticSearch
  • Apache Solr
  • Manticore Search

IDE's

  • ICE Coder
  • Theia
  • web IDE

Several

  • workspace – Workspace (Laradock container that includes a rich set of pre-configured useful tools)
    • PHP CLI
    • Composer
    • git
    • I came
    • xDebug
    • Linuxbrew
    • node
    • V8JS
    • gulp
    • SQLite
    • Laravel Envoy
    • Deployer
    • Yarn
    • SOAP
    • Drush
    • WordPress CLI
  • Apache ZooKeeper: Centralized service for distributed systems in a hierarchical key-value store
  • Kibana: Visualize Elasticsearch Data and Navigate the Elastic Stack
  • Dejavu: Edit Your Elasticsearch Data
  • LogStash: Server-side data processing pipeline that receives and processes data from a multitude of sources simultaneously
  • Jenkins: Automation Server, which provides plugins to support building, deploying and automating any project
  • Certbot: Automatically enable HTTPS on your website
  • Swoole: framework production-level asynchronous programming with coroutines, parallelism, for PHP
  • SonarQube: Continuous code quality inspection to perform automatic reviews with static code analysis for bugs and more
  • Gitlab: a single application for the entire software development lifecycle
  • PostGIS: Database extender for PostgreSQL. Adds support for geographic objects, allowing location queries to be run in SQL
  • Blackfire: Enables all PHP and IT/Ops developers to continually check and improve the performance of their applications
  • Laravel Echo: The Power of WebSockets in Your Laravel Applications
  • Mercure: Server-side events
  • Phalcon: PHP framework based on the model-view-controller pattern
  • Minio: Cloud storage server released under Apache License v2, compatible with Amazon S3
  • AWS EB CLI: CLI that helps you deploy and manage your AWS Elastic Beanstalk applications and environments
  • Thumbor: photo thumbnail service
  • IPython: Provides a rich architecture for interactive computing
  • Jupyter Hub: Multi-user Jupyter notebook
  • Portainer: Build and manage your Docker environments with ease
  • Docker Registry: The Docker Registry implementation for storing and distributing Docker images
  • Docker Web UI: A browser-based solution for browsing and modifying a private Docker registry

Final considerations

The project is open-source, and if you can't find the software configuration you want to see in Laradock, you're welcome to contribute an improvement.

To learn more and go deeper, read the sore Laradock series tutorials:

keep up to date

Don't forget to follow me on twitter and sign the Mazer.dev channel on Youtube to receive updates on new articles, video lessons and free courses in software development and engineering.

Series NavigationLaradock, installation and configuration >>

Leave a Reply

Your email address will not be published.

en_USEnglish
%d bloggers like this: