This is a Docker stack for local Drupal development. Future versions may incorporate features for production environments, but for now this if for local development.
This stack is largely based on Drupal4Docker by Wodby (GitHub repo: wodby/docker4drupal), but with a Convivio flavour.
The stack is built to work pretty much out-of-the-box with the Drupal Composer project.
- Docker is installed locally already.
To use this out-of-the-box:
- Your Drupal files are in ./web
- Note: everything in the root directory of your instance is added as a bind mount in your Docker stack Nginx and PHP containers.
- Start a new Drupal Composer site to begin your project.
- Download the latest stable release of this repo.
- unzip it to the root of your Drupal project.
- Copy .env.example » .env
- Edit .env settings to suit your needs. Most settings should be obvious and/or self-evident.
- you should change
PROJECT_NAME
andPROJECT_BASE_URL
for your project.PROJECT_NAME
is used to create a persistent data volume. It should be a unique name so that data for your project persists in your local dev environment.- You will be able to access your installation at
PROJECT_BASE_URL
when your stack is running.
- The other thing you'll likely want to change is
NGINX_SERVER_ROOT
. If your project is does not have Drupal installed in./web
(mounted at/var/www/html/web
) then you should change this value as appropriate.
- you should change
If you want to import your database, uncomment the line for mariadb-init volume in your docker-compose.yml
file. Create the volume directory ./mariadb-init
in the same directory as the compose file and put there your .sql .sql.gz .sh file(s). All SQL files will be automatically imported once MariaDB container has started.
For other import/export options, see: https://wodby.com/stacks/drupal/docs/local/import-export/
Check https://wodby.com/stacks/drupal/docs/local/import-export/ for issues related to running Docker on MacOS.
The Makefile and docker.mk included in this project provide some easy CLI tools to work with this Docker stack for Drupal.
To start your Docker stack:
$ make up
To stop your Docker stack:
$ make down
Usage:
$ make {command}
Commands:
up Start up all container from the current docker-compose.yml
stop Stop all containers for the current docker-compose.yml (docker-compose stop)
down Same as stop
prune Stop and remove containers, networks, images, and volumes (docker-compose down)
ps List container for the current project (docker ps with filter by name)
shell Enter PHP container as default user (docker exec -ti $CID sh)
drush [command] Execute drush command (runs with -r /var/www/html/web, you can override it via DRUPAL_ROOT=PATH)
logs [service] Show containers logs, use [service] to show logs of specific service
Cf. https://wodby.com/stacks/drupal/docs/local/make-commands/