|
| 1 | +# Docker LAMP Stack |
| 2 | + |
| 3 | +A flexible and robust LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack Docker image with additional tools like Redis, Python, Node.js, and Composer. This project supports configurable PHP and phpMyAdmin versions, managed by Supervisor for process reliability. |
| 4 | + |
| 5 | +## Features |
| 6 | +- **Base:** Ubuntu 24.04 |
| 7 | +- **Web Server:** Apache 2 |
| 8 | +- **Database:** MariaDB |
| 9 | +- **PHP:** Configurable version (default: 7.4) with essential and optional extensions |
| 10 | +- **phpMyAdmin:** Configurable version (default: 5.1.1) with fallback to 5.2.1 |
| 11 | +- **Extras:** Redis, Python 3, Node.js 18.x, Composer |
| 12 | +- **Process Management:** Supervisor |
| 13 | +- **Persistence:** Volumes for MySQL, application data, and logs |
| 14 | +- **Ports:** 80 (Apache), 3306 (MariaDB), 6379 (Redis), with optional additional ports |
| 15 | + |
| 16 | +## Requirements |
| 17 | +- Docker installed on your system |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +# Docker LAMP Stack |
| 22 | + |
| 23 | +A flexible and robust LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack Docker image with additional tools like Redis, Python, Node.js, and Composer. This project supports configurable PHP and phpMyAdmin versions, managed by Supervisor for process reliability. |
| 24 | + |
| 25 | +## Features |
| 26 | +- **Base:** Ubuntu 24.04 |
| 27 | +- **Web Server:** Apache 2 |
| 28 | +- **Database:** MariaDB |
| 29 | +- **PHP:** Configurable version (default: 7.4) with essential and optional extensions |
| 30 | +- **phpMyAdmin:** Configurable version (default: 5.1.1) with fallback to 5.2.1 |
| 31 | +- **Extras:** Redis, Python 3, Node.js 18.x, Composer |
| 32 | +- **Process Management:** Supervisor |
| 33 | +- **Persistence:** Volumes for MySQL, application data, and logs |
| 34 | +- **Ports:** 80 (Apache), 3306 (MariaDB), 6379 (Redis), with optional additional ports |
| 35 | + |
| 36 | +## Requirements |
| 37 | +- Docker installed on your system |
| 38 | + |
| 39 | +## Usage |
| 40 | + |
| 41 | +### Build the Image |
| 42 | +1. Clone or download this repository: |
| 43 | + ```bash |
| 44 | + git clone https://github.com/syspanel/docker-lamp-stack.git |
| 45 | + cd docker-lamp-stack |
| 46 | + |
| 47 | + Build the Docker image with specific PHP and phpMyAdmin versions: |
| 48 | + PHP 7.4 with phpMyAdmin 5.1.1 (default): |
| 49 | + bash |
| 50 | + |
| 51 | + docker build -t docker-lamp-stack . |
| 52 | + |
| 53 | + PHP 7.4 with phpMyAdmin 5.1.1: |
| 54 | + bash |
| 55 | + docker build -t docker-lamp-stack-74 --build-arg PHP_VERSION=7.4 --build-arg PHPMYADMIN_VERSION=5.1.1 . |
| 56 | + PHP 8.0 with phpMyAdmin 5.2.1: |
| 57 | + bash |
| 58 | + docker build -t docker-lamp-stack-80 --build-arg PHP_VERSION=8.0 --build-arg PHPMYADMIN_VERSION=5.2.1 . |
| 59 | + PHP 8.1 with phpMyAdmin 5.2.1: |
| 60 | + bash |
| 61 | + docker build -t docker-lamp-stack-81 --build-arg PHP_VERSION=8.1 --build-arg PHPMYADMIN_VERSION=5.2.1 . |
| 62 | + PHP 8.2 with phpMyAdmin 5.2.1: |
| 63 | + bash |
| 64 | + docker build -t docker-lamp-stack-82 --build-arg PHP_VERSION=8.2 --build-arg PHPMYADMIN_VERSION=5.2.1 . |
| 65 | + PHP 8.3 with phpMyAdmin 5.2.1: |
| 66 | + bash |
| 67 | + docker build -t docker-lamp-stack-83 --build-arg PHP_VERSION=8.3 --build-arg PHPMYADMIN_VERSION=5.2.1 . |
| 68 | + Note: If the specified PHPMYADMIN_VERSION is unavailable, it falls back to 5.2.1. |
| 69 | + |
| 70 | +Run the Container |
| 71 | + |
| 72 | +Run the container with persistent volumes for the application, MySQL data, and logs. Below is an example with additional ports and log mapping: |
| 73 | + bash |
| 74 | + |
| 75 | + docker run --name "docker-lamp-stack" \ |
| 76 | + -p "8080:80" -p "8082:3306" -p "8083:6379" \ |
| 77 | + -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql \ |
| 78 | + -v ${PWD}/logs:/var/log \ |
| 79 | + docker-lamp-stack-74 |
| 80 | + |
| 81 | +Basic Example (without additional ports or logs): |
| 82 | + bash |
| 83 | + |
| 84 | + docker run --name "docker-lamp-stack" \ |
| 85 | + -p "8080:80" -p "8082:3306" -p "8083:6379" \ |
| 86 | + -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql \ |
| 87 | + docker-lamp-stack |
| 88 | + |
| 89 | +Access |
| 90 | + |
| 91 | + Web Server: http://localhost:16080 (or 8080 for basic example; displays "Server running! PHP x.x.x") |
| 92 | + phpMyAdmin: http://localhost:16080/phpmyadmin (or 8080; user: root, password: root) |
| 93 | + MariaDB: Port 16082 (or 8082), user: root, password: root |
| 94 | + Redis: Port 16083 (or 8083) |
| 95 | + Additional Ports: 16081 (443), 16084 (8000), 16085 (9000), 16086 (10000) are mappable but require additional configuration for use (e.g., SSL for 443). |
| 96 | + |
| 97 | +Logs |
| 98 | + |
| 99 | +Logs are available in the /var/log directory inside the container. With the -v ${PWD}/logs:/var/log volume, they are persisted to the logs directory on the host: |
| 100 | + |
| 101 | + Apache: ${PWD}/logs/apache2/supervisor.log |
| 102 | + MariaDB: ${PWD}/logs/mariadb/supervisor.log, ${PWD}/logs/mariadb/error.log |
| 103 | + Redis: ${PWD}/logs/redis/supervisor.log |
| 104 | + Supervisor: ${PWD}/logs/supervisor/supervisord.log |
| 105 | + |
| 106 | +Configuration |
| 107 | + |
| 108 | +Configuration files are located in the config/ directory: |
| 109 | + |
| 110 | + Apache: config/apache/000-default.conf |
| 111 | + PHP: config/php/apache2-php.ini and config/php/cli-php.ini |
| 112 | + MariaDB: config/mariadb/custom.cnf |
| 113 | + Redis: config/redis/redis.conf |
| 114 | + Supervisor: config/supervisor/ (main config and service-specific files) |
| 115 | + Startup Script: config/start.sh (initializes MariaDB and creates log directories) |
| 116 | + |
| 117 | +Supported PHP Versions |
| 118 | + |
| 119 | +Any version available in the ppa:ondrej/php repository (e.g., 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3). Optional extensions are installed if available; missing ones are skipped without failing the build. |
| 120 | +phpMyAdmin Fallback |
| 121 | + |
| 122 | +If the specified PHPMYADMIN_VERSION is not found, the build automatically falls back to version 5.2.1, ensuring compatibility with modern PHP versions. |
| 123 | +Repository |
| 124 | + |
| 125 | +This project is hosted on GitHub: syspanel/docker-lamp-stack |
| 126 | +License |
| 127 | + |
| 128 | +This project is licensed under the MIT License. See the file for details. |
| 129 | +Author |
| 130 | + |
| 131 | +Marco Costa marcocosta@gmx.com |
| 132 | +Support the Project |
| 133 | + |
| 134 | +### Support the Project |
| 135 | +If you find this project useful, consider supporting its development with a donation via PayPal: |
| 136 | + |
| 137 | +[](https://www.paypal.com/donate/?business=marcocosta@gmx.com¤cy_code=USD) |
| 138 | + |
| 139 | + |
0 commit comments