This is a sample Docker Compose configuration that sets up a development environment with Apache, PHP 8.2, and MariaDB 10.11.3. It allows you to quickly spin up a local development environment for web applications that require these technologies.
- Docker (https://www.docker.com/)
- Docker Compose (https://docs.docker.com/compose/)
- Clone this repository:
git clone https://github.com/zeyadmbk/docker-compose-apache-php-mariadb-dev.git
- Navigate to the project directory:
cd docker-compose-apache-php-mariadb-dev
- Modify the
docker-compose.yml
file according to your requirements. You can adjust the exposed ports, database credentials, and other settings as needed. - Start the containers:
docker-compose -f docker-compose.yml up -d
- Access your web application in a browser:
http://localhost:80
The docker-compose.yml
file contains the following services:
- Build: using custom docker image built using
./build/apache-php/Dockerfile
file. - Ports:
80:80
(map container port 80 to host port 80)
- Volumes:
/usr/dev/project/:/var/www/html/
(mount the/usr/dev/project/
directory to Apache's document root)
- Image:
mariadb:10.11.3
- Environment variables:
MYSQL_ROOT_PASSWORD
(set your desired root password)MYSQL_DATABASE
(set the name of the initial database) (Optional)MYSQL_USER
(a username account to be created when the container is created) (Optional)MYSQL_PASSWORD
(a password for the user account above to be created when the container is created) (Optional)
Feel free to modify this configuration based on your specific requirements.
- This configuration is intended for development purposes only. It may not be suitable for production environments.
- Make sure to secure your database by using strong passwords and other security measures when deploying to a production environment.
This project is licensed under the MIT License. Feel free to use and modify it to suit your needs.
For more information on Docker Compose and its capabilities, please refer to the official documentation.