d93d4713fd512ed754dcdd0924df1e5322842bd6
All checks were successful
Deploy LAMP / Deploy LAMP (push) Successful in 22s
Lightweight LAMP Stack with Docker
This repository contains a lightweight LAMP (Linux, Apache, MySQL, PHP) stack using Docker containers.
Features
- Apache 2.4 (Alpine-based) - Web server with support for virtual hosts
- PHP 8.4 (FPM Alpine-based) - Latest PHP version
- MySQL 8.0 - Relational database
- Adminer - Lightweight database management tool (alternative to phpMyAdmin)
- Virtual Host Support - Easy to add new virtual hosts
- Optimized Images - Using Alpine Linux for minimal footprint
Directory Structure
Docker-Lamp/
├── apache/ # Apache configuration and Dockerfile
├── php/ # PHP configuration and Dockerfile
├── mysql/ # MySQL configuration and Dockerfile
├── adminer/ # Adminer configuration and Dockerfile
├── html/ # Web root directory (mounted to containers)
├── docker-compose.yml # Docker Compose configuration
└── README.md # This file
Quick Start
- Clone this repository
- Navigate to the project directory
- Start the stack:
docker-compose up -d
- Access the services:
- Web server: http://localhost:32000
- Adminer (MySQL GUI): http://localhost:32001
- PHP Info page: http://localhost:32000/index.php
Configuration
Apache Virtual Hosts
To add a new virtual host:
- Create a new
.conffile inapache/vhosts/ - Configure your virtual host settings
- Restart Apache:
docker-compose restart apache
Example virtual host configuration is provided in apache/vhosts/example.conf
Environment Variables
MySQL credentials are configured in docker-compose.yml:
- Database:
lamp_db - Username:
lamp_user - Password:
lamp_password - Root Password:
root_password
Adminer uses these same credentials by default.
Customization
Changing PHP Version
Modify the PHP Dockerfile to use a different PHP version tag.
Adding PHP Extensions
Edit the PHP Dockerfile to install additional extensions using docker-php-ext-install.
Persistent Data
MySQL data is persisted in a Docker volume named mysql-data.
Stopping the Stack
docker-compose down
To remove volumes as well:
docker-compose down -v
Notes
- All images are based on Alpine Linux for minimal size
- Apache is configured to allow
.htaccessoverrides - PHP-FPM communicates with Apache via the shared volume
- Adminer provides a clean, lightweight interface for database management
Description
Languages
Dockerfile
95.5%
PHP
4.5%