With the release of Drupal 9 just days away, I wanted to take it for a spin, and updated the Shepherd scaffold we use for OpenShift deployments so that things work nicely. If you already have docker, docker-compose & composer installed, try these steps to give it a spin.

Create a new project using the recommended method of the release candidate:
cd /tmp
composer create-project drupal/recommended-project:^9.0 test-project

While this is enough to get things up and going, by adding the Shepherd scaffold, it will make the site almost ready for deploying to OpenShift, docker or Kubernetes easily with a lot of extra information in web/sites/default/settings.php and give a full mysql+redis/memcache with drush and robo setup locally as well. There are just a couple of steps involved.

Change into the newly created project directory:

cd ./test-project

Update composer.json to allow our additional scaffold to run:

composer 1.x method
composer config extra.drupal-scaffold.allowed-packages 'singularo/shepherd-drupal-scaffold'

Perform a tiny bit of magic that will not be needed when composer 2 is released and this works. (convert a string to an array in composer.json):

sed -i.bak 's/: "singularo\/shepherd-drupal-scaffold"/: ["singularo\/shepherd-drupal-scaffold"]/' composer.json
composer 2.x method
composer config --append allow-plugins.singularo/shepherd-drupal-scaffold true
composer config --append --json extra.drupal-scaffold.allowed-packages '["singularo/shepherd-drupal-scaffold"]'
Finally install the scaffold additions and perform its changes:
composer require singularo/shepherd-drupal-scaffold:dev-develop

Once the installation is complete, the dsh script will be present in the local directory to start up the docker shell, and you can bring the new Drupal 9 site up with a couple of commands:

./dsh

Wait while any images are built or downloaded. Once the shell prompt appears, give it about 10 seconds longer for the mysql database to come up fully, then build a standard Drupal 9 installation with:

robo build

Once that is complete, access the new Drupal 9 site via http://localhost, login with admin/password and have a look around at your new Drupal 9 site. Try the Claro theme. If you want to add modules, the process is straightforward. A simple example of the steps inside the web container using admin toolbar:

composer require drupal/admin_toolbar

After the download, drush can be used to enable the module if you like:

drush en admin_toolbar
There you go, a quick way to try out Drupal 9 easily in a production style docker container. To exit/shutdown the stack:
exit
./dsh stop

If a single command line to paste is more your style, here it is, adjust the PROJECT var and paste away:

composer 1.x

PROJECT=test && \
composer create-project drupal/recommended-project:^9.0 -s rc ${PROJECT} && \
cd ./${PROJECT} && \
composer config extra.drupal-scaffold.allowed-packages 'singularo/shepherd-drupal-scaffold' && \
sed -i.bak 's/: "singularo\/shepherd-drupal-scaffold"/: ["singularo\/shepherd-drupal-scaffold"]/' composer.json && \
composer require singularo/shepherd-drupal-scaffold:dev-develop && \
composer config --unset extra.drupal-core-project-message && \
./dsh

composer 2.x

PROJECT=test && \
composer create-project drupal/recommended-project:^9.0 -s rc ${PROJECT} && \
cd ./${PROJECT} && \
composer2 config extra.drupal-scaffold.allowed-packages --json '["singularo/shepherd-drupal-scaffold"]' && \
composer require singularo/shepherd-drupal-scaffold:dev-develop && \
composer config --unset extra.drupal-core-project-message && \
./dsh