This project provides a Docker-based local development environment for Drupal 11 using PHP-FPM, Nginx, and PostgreSQL.
- Docker
- Docker Compose
- mkcert (for local HTTPS trust)
Run the following script to create your .env file (interactively), build Docker images, and download Drupal:
./site setupUse the management script to handle /etc/hosts updates, HTTPS certificates, and start the containers:
./site startNote: This will prompt for your sudo password to update /etc/hosts.
- Open https://drupal.local
- Database Settings (PostgreSQL):
- Database name:
drupal_db(or as set in .env) - Database username:
drupal_user - Database password:
verystrongpassword(or as set in .env) - Host:
postgres
- Database name:
The ./site script provides easy management of the containers and local configuration:
./site setup: Interactively creates.env, builds images, and initializes Drupal../site start: Verifies ports 80/443, updates/etc/hosts, generates SSL certs, and starts containers../site stop: Stops and removes all containers for the project../site restart: Stops and then starts the environment again../site reset: Danger: Resets the project back to the clean boilerplate state.
To enter the PHP container and run commands directly:
docker exec -it ${PROJECT_NAME}_php bash(Alternatively, you can use docker compose exec php bash)
Drush is installed as a Composer dependency. You can run it easily using the helper script:
./drush [command]Example: Clear all caches:
./drush crInstall new modules or dependencies:
docker compose exec php composer require drupal/[module_name]To enter the PostgreSQL shell:
docker compose exec postgres psql -U drupal_user -d drupal_dbweb/: Drupal root (index.php, themes, modules).vendor/: Composer-managed dependencies and Drush.nginx.conf.template: Template for Nginx server configuration.Dockerfile: Custom PHP image definition.docker-compose.yml: Service orchestration.