A Docker stack for local PHP development.
- PHP-FPM 8.x or 7.4 to choose from
- Common extensions and Composer pre-installed
- Support for both Laravel and WordPress CLIs
- Nginx or Apache to choose from
- Both services commonly pre-configured
- Self-signed SSL certificate included
- MySQL 8.0 with UTF-8 Unicode support
- Default database created on startup
- For MySQL 5.7 see this tag
- Node and NPM for frontend tasks
- Alpine Linux for fast build times
- Place
docker-compose.yml
anddocker/
into your project directory - Optionally, customize the provided container and service configuration
- See the
.env.example
for a list of all supported environment variables
Lastly, get Docker up and running:
docker compose up -d
Now you can access your local development environment either via http://localhost or https://localhost on your host system. By default, the web service points to public
as the document root. See the .env.example
for how to connect to the database.
For SSL to work, you must enable self-signed certificates in your browser.
When customizing the provided configuration, you'll most likely want to:
- Pick a web service to use in
docker-compose.yml
- Pick the PHP version to use in
docker/php/Dockerfile
- Enable the Laravel or WordPress CLI in
docker/php/Dockerfile
- Change the database environment variables in
docker-compose.yml
Use docker compose exec <service> <command>
:
docker compose exec php composer install
docker compose exec node npm install
Or, to get an interactive prompt (shell):
docker compose exec web /bin/sh
Enable and call the alias defined in docker/php/Dockerfile
:
docker compose exec php artisan
docker compose exec php wp
Licensed under the MIT license.