A local Drupal 11 stack with Docker, Nginx, PHP-FPM and PostgreSQL. Use it for module and theme development.
- Docker and Docker Compose
- mkcert, for local HTTPS certificates
- Create your
.env, build the Docker images and download Drupal:
./site setup- Start the containers, update
/etc/hostsand generate the HTTPS certificates:
./site startThe script asks for your sudo password to edit /etc/hosts.
- Open https://drupal.local and run the Drupal installer. Database settings:
| Setting | Value |
|---|---|
| Name | drupal_db, or your .env value |
| User | drupal_user |
| Password | verystrongpassword, or your .env value |
| Host | postgres |
| Command | What it does |
|---|---|
./site setup |
Creates .env interactively, builds the images, initializes Drupal. |
./site start |
Checks ports 80/443, updates /etc/hosts, generates SSL certificates, starts the containers. |
./site stop |
Stops and removes the project containers. |
./site restart |
Stops, then starts the environment again. |
./site reset |
Warning: removes everything and resets to the clean boilerplate. |
Enter the PHP container and run commands directly:
docker compose exec php bashRun Drush, installed as a Composer dependency, through the helper script. To clear all caches:
./drush crInstall a module with Composer:
docker compose exec php composer require drupal/[module_name]Open the PostgreSQL shell:
docker compose exec postgres psql -U drupal_user -d drupal_dbweb/, the Drupal root withindex.php, themes and modulesvendor/, Composer dependencies and Drushnginx.conf.template, the Nginx server configuration templateDockerfile, the PHP imagedocker-compose.yml, service orchestration