/lamp-docker

PHP 7.2 + Apache + MariaDB

Primary LanguageDockerfileMIT LicenseMIT

varnav/lamp

Docker Pulls Docker Build Status

This Docker container implements a last generation LAMP stack with a set of popular PHP modules. Postfix service to allow sending emails through PHP mail() function. Certbot allows easy configuration for https.

What's special

Based on fauria/lamp

  • Ubuntu 18.04
  • PHP 7.2
  • MariaDB 10.4 from official repos
  • Thrown away most unneeded modules, nmp & stuff
  • Added support for Certbot (Let's encrypt)

Exposed port and volumes

The image exposes ports 80 and 443, and exports volumes:

  • /var/www/html, used as Apache's DocumentRoot directory.
  • /var/lib/mysql, where MariaDB data files are stored.
  • /etc/apache2, where Apache configuration files are stored.
  • /etc/letsencrypt for Certbot's files and keys

Please, refer to https://docs.docker.com/storage/volumes for more information on using host volumes.

Usage

docker run -d -p 80:80 -p 443:443 --name lamp-1 -v /opt/example.com/html:/var/www/html -v /opt/example.com/letsencrypt:/etc/letsencrypt -v example.com-database:/var/lib/mysql varnav/lamp

Copy your files to /opt/example.com/html

Get HTTPS cert:

docker exec -i -t lamp-1 bash
certbot --apache -d example.com

Get inside a running container and open a MariaDB console:

docker exec -i -t lamp-1 bash
mysql -u root