php

PHP development environment for Docker

alexandrefreire

Alexandre Freire

Posted on August 5, 2020

PHP development environment for Docker

Laradock is a full PHP development environment for Docker.

It supports a variety of common services, all pre-configured to provide a ready PHP development environment.

Features

  • Easy switch between PHP versions: 7.4, 7.3, 7.2, 7.1, 5.6…
  • Choose your favorite database engine: MySQL, Postgres, MariaDB…
  • Run your own stack: Memcached, HHVM, RabbitMQ…
  • Each software runs on its own container: PHP-FPM, NGINX, PHP-CLI…
  • Easy to customize any container, with simple edit to the Dockerfile.
  • All Images extends from an official base Image. (Trusted base Images).
  • Pre-configured NGINX to host any code at your root directory.
  • Can use Laradock per project, or single Laradock for all projects.
  • Easy to install/remove software’s in Containers using environment variables.
  • Clean and well structured Dockerfiles (Dockerfile).
  • Latest version of the Docker Compose file (docker-compose).
  • Everything is visible and editable.
  • Fast Images Builds.

Quick Overview

Let’s see how easy it is to setup our demo stack PHP, NGINX, MySQL, Redis and Composer:

1 - Clone Laradock inside your PHP project:

git clone https://github.com/Laradock/laradock.git
2 - Enter the laradock folder and rename env-example to .env.

cp env-example .env
3 - Run your containers:

docker-compose up -d nginx mysql phpmyadmin redis workspace 
4 - Open your project’s .env file 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! enjoy :)
Enter fullscreen mode Exit fullscreen mode

Supported Services

Laradock, adheres to the ‘separation of concerns’ principle, thus it runs each software on its own Docker Container. You can turn On/Off as many instances as you want without worrying about the configurations.

To run a chosen container from the list below, run docker-compose up -d {container-name}. The container name {container-name} is the same as its folder name. Example to run the “PHP FPM” container use the name “php-fpm”.

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 Apps:

PhpMyAdmin, Adminer, PgAdmin

Cache Engines:

Redis, Redis Web UI, Redis Cluster, Memcached, Aerospike, Varnish

Message Brokers:

RabbitMQ, RabbitMQ Admin Console, Beanstalkd, Beanstalkd Admin, Console, Eclipse Mosquitto, PHP Worker, Laravel Horizon, Gearman

Mail Servers:

Mailu, Mailhog, MailDev

Log Management:

GrayLog

Testing:

Selenium

Monitoring:

Grafana, NetData

Search Engines:

ElasticSearch, Apache Solr, Manticore Search, IDE’s, ICE Coder, Theia, Web IDE

Miscellaneous:

Workspace (Laradock container that includes a rich set of pre-configured useful tools), PHP CLI, Composer, Git, Vim, xDebug, Linuxbrew, Node, V8JS, Gulp, SQLite, Laravel Envoy, Deployer, Yarn, SOAP, Drush, Wordpress CLI, Apache ZooKeeper (Centralized service for distributed systems to a hierarchical key-value store)
Kibana, LogStash, Jenkins, Certbot, Swoole, SonarQube, Gitlab,
PostGIS, Blackfire, Laravel Echo, Phalcon, Minio, AWS EB CLI, Thumbor, IPython, Jupyter Hub, Portainer, Docker Registry, Docker Web UI.

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

If you modify docker-compose.yml, .env or any dockerfile file, you must re-build your containers, to see those effects in the running instance.

If you can’t find your Software in the list, build it yourself and submit it. Contributions are welcomed :)

https://laradock.io/

💖 💪 🙅 🚩
alexandrefreire
Alexandre Freire

Posted on August 5, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related