lombax85/docker-apache-mysql-php-mongo
Install via Composer (if using the package as a dependency):
composer require lombax85/docker-apache-mysql-php-mongo
Note: This package is outdated (last release 2016) and primarily designed for Docker orchestration, not a traditional Composer package. For Laravel, you’d typically use this via Docker Compose or CLI integration.
Alternative: Use Docker Compose Directly
Clone the repo or manually define a docker-compose.yml mirroring its structure:
version: '3'
services:
apache:
image: httpd:2.4
ports:
- "80:80"
volumes:
- ./src:/usr/local/apache2/htdocs
php:
image: php:7.4-fpm
volumes:
- ./src:/var/www/html
mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: laravel
volumes:
- mysql_data:/var/lib/mysql
mongo:
image: mongo:4.4
workspace:
image: appropriate/curl
volumes:
- ./src:/var/www/html
volumes:
mysql_data:
First Use Case: Local Laravel Dev Environment
workspace container to run Artisan commands:
docker-compose exec workspace php artisan migrate
http://localhost (Apache) with MySQL/MongoDB services linked.Database Migrations & Seeding
workspace container to run Laravel’s CLI tools:
docker-compose exec workspace php artisan migrate --env=local
jenssegers/laravel-mongodb), ensure the MONGO_HOST env var points to the mongo service.Environment-Specific Config
.env for Docker:
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=root
MONGO_CONNECTION=mongodb
MONGO_HOST=mongo
MONGO_PORT=27017
.env file into the workspace container for consistency.Shared Storage for Sessions/Cache
storage/framework (sessions/cache) or bootstrap/cache. Mount a named volume:
services:
workspace:
volumes:
- laravel_storage:/var/www/html/storage
volumes:
laravel_storage:
Debugging & Real-Time Reloading
docker-compose up with volumes mounted for live code reloading.php:
image: php:7.4-fpm
volumes:
- ./src:/var/www/html
environment:
XDEBUG_CONFIG: remote_host=host.docker.internal
extra_hosts:
- "host.docker.internal:host-gateway"
Testing with Laravel’s HTTP Tests
workspace container to run tests:
docker-compose exec workspace php artisan test
APP_URL=http://apache in .env to match the container hostname.Outdated Images
php:5.6-fpm). Override in docker-compose.yml:
php:
image: php:8.1-fpm
Networking Quirks
docker-compose exec workspace ping mysql to verify connectivity.host.docker.internal resolves to your host machine’s IP.Persistent Data
mysql:
volumes:
- mysql_data:/var/lib/mysql
PHP Extensions
pdo_mysql, bcmath). Extend the image:
FROM php:8.1-fpm
RUN docker-php-ext-install pdo_mysql bcmath
CouchDB Deprecation
docker-compose.yml unless explicitly needed.Logs
docker-compose logs -f apache
docker-compose exec apache tail -f /usr/local/apache2/logs/error_log
Shell Access
docker-compose exec workspace bash
Environment Variables
docker-compose exec workspace env
Custom PHP Configuration
php.ini by mounting a custom file:
php:
volumes:
- ./php.ini:/usr/local/etc/php/conf.d/custom.ini
Laravel Forge/Envoyer
docker-compose.yml for production by:
/var/www instead of the project root.CI/CD Integration
docker-compose.yml in GitHub Actions/GitLab CI:
services:
mysql:
image: mysql:5.7
# ... other services
jobs:
test:
services:
- mysql
script:
- docker-compose exec workspace php artisan test
How can I help you explore Laravel packages today?