/docker-compose-lamp

Docker Compose LAMP stack

Primary LanguagePHPMIT LicenseMIT

Docker Compose LAMP stack

Based on the Docker images, built to be fast, small and extendable LAMP stack.

Stack

The LAMP stack consists of the following containers:

Container Versions Service name Image Enabled by default
PHP-FPM php-7, php-5 php-fpm [lordius/alpine-php_fpm]
Apache latest apache2_mpm [lordius/alpine-apache]
Nginx latest nginx [lordius/alpine-nginx]
Node.js node:alpine node [node]
Mailhog latest mailhog [mailhog/mailhog]
NGROK latest ngrok [lordius/alpine-ngrok]
Solr 6-alpine solr [solr]
PhpMyAdmin latest phpmyadmin [phpmyadmin/phpmyadmin]
Adminer latest adminer [adminer]
MySQL latest mysql [mysql]
PostgreSQL postgres:alpine postgres [postgres]
MongoDB latest mongo [mongo]
Redis redis:alpine redis [redis]
Memcached memcached:alpine memcached [memcached]
PHP-FPM-DATA php-7, php-5 php-fpm-data [lordius/alpine-php_fpm]
StandaloneFirefoxDebug 2.48.2 selenium [selenium/standalone-firefox-debug]

Requirements

Linux

Install Docker and Docker Compose.

Windows, MacOS

Docker Toolbox (Recommend)

Install Docker Toolbox.

Introduction

Linux

Run inside the folder with docker-compose.yml: docker-compose up -d

To view the PHP info with the Apache2 in MPM mode use the IP: http://172.55.0.3/info.php.

To view the PHP info with the NGINX use the IP: http://172.55.0.4/info.php.

MailHog is available under http://172.55.0.6:8025

NGROK is available under http://172.55.0.7:4040

PhpMyAdmin is available under http://172.55.0.9

You can edit your system host file for accessing containers via domain names by adding lines (or something like this based on your IP and domains, don't forget to change extra_hosts in docker-compose.yml):

172.55.0.4 site.dockerlamp

172.55.0.6 mailhog.dockerlamp

172.55.0.7 ngrok.dockerlamp

172.55.0.9 phpmyadmin.dockerlamp

Docker Toolbox

Windows

  • Download and extract Docker Compose LAMP into your user directory. Like C:\Users\UserName\docker-compose-lamp.
  • Launch Docker Quickstart Terminal.
  • Go to the docker-compose-lamp directory: cd /c/Users/UserName/docker-compose-lamp.
  • Run docker-compose up -d
  • Launch Kitematic (Alpha).
  • Go to the NGINX container and press Settings tab.
  • Press the Hostname/Ports subtab.
  • Update the Published IP:PORT with your value, e.g. 192.168.99.100:80 and press Save.
  • Navigate to a browser http://192.168.99.100/info.php and check that the NGINX container is available from the browser.
  • Do the same thing with all other containers that you need to access in a browser. Don't forget, that 80 port is now busy, so you can attach other containers to some other ports, like 8080, 9080, etc...

You can edit your system host file for accessing some containers via domain name by adding line (or something like this based on your IP and domains, don't forget to change extra_hosts in docker-compose.yml) like this: 192.168.99.100 site.dockerlamp

Docker Toolbox Known Issues

If you want to archive your project on Linux and extract to use on Windows with Docker Toolbox just remove ibdata and ib_logfile* files in your MySQL data directory. Uncomment in docker-compose.yml section # build: docker/images/mysql/. and remove section image: mysql. Then run a command: docker-compose stop && docker-compose rm -f && docker-compose up --build -d To verify work check that MySQL container run a command: docker-compose ps.

MacOS

Similar to Windows section instruction.

Extra features

To enable Selenium check docker-compose.yml and uncomment related selenium and php-fpm-data sections. The same for other images not enabled by default.

To enable custom configs from files, please, check the image info and uncomment related image volumes section.

You can build own images based on base images. Check the php-fpm section for using custom image builds. The custom PHP-FPM image sample is located in the directory - docker/images/php-fpm.

For running multiple instances on your local machine, you can update the IP range or ports inside docker-compose.yml. For this, on your instance, change IPs to another range, e.g. from 172.55 to 172.54.*. The same are for ports.

Documentation

See READMEs for more details, like environment variables for images:

License

This project is licensed under the MIT open source license.