This repository provides a Docker Compose setup for a PHP development environment with Apache, MySQL, and PHPMyAdmin. The setup includes three services:
- Web: A PHP 8 + Apache container serving the web application.
- Database (MySQL): A MySQL 5.7 database container.
- PHPMyAdmin: A web-based interface for managing the MySQL database.
Ensure you have the following installed on your system:
sudo apt install docker.io docker-compose
git clone https://github.com/lordgaruda/web-containerizer.git
cd docker-lamp
Run the following command to start all services:
sudo docker-compose up -d
- Web Server (PHP + Apache): http://:8080
- PHPMyAdmin: http://:8090
- MySQL Database: Accessible on
db:3306
- Image:
php:8-apache
- Container Name:
php-apache-container
- Ports:
8080:80
- Mounts the
./site
directory to/var/www/html
in the container.
- Image:
mysql:5.7
- Data stored in the
db_data
volume. - Environment Variables:
- for environment just rename file sample.env to .env
cp sample.env .env
- Ports:
3306:3306
- Image:
phpmyadmin
- Accessible on port
8090
. - Connects to the MySQL database.
To stop the running containers, use:
docker-compose down
- Ensure that the
site
directory exists in your project root for PHP files. - Modify database credentials if needed in
docker-compose.yml
.