Installing Drupal on Docker/Orbstack Mac localhost

You are currently viewing Installing Drupal on Docker/Orbstack Mac localhost

Yes, that is a mouthfull, but it makes sense to somebody

Just for the fun of it, because I am getting set up and configured out on a new MBP m4 pro, it’s time to get these things plugged in again and see what’s up to date here. Even though I just rebuilt from the image of the last machine that I was working with and kept all my configs, aliases, and customizations, it became apparent that now was a good time as any to go through and make sure all these little things still work and that there aren’t any good scripts that I have been ignoring for too long.

So not long after poring through my zsh configs, git cofigs, and pouring through all the known_hosts that I clearly have not known for a good long time but still have archived ssh key fragments for over the years, it was also a good time to see if these other neglected tools still work here, like docker. I’ll confess that this is one of those things that once you learn enough of what you need to do to get projects going locally, I almost always ignore that it is back there running away until I have something good to look at, and these days that leans more towards the devops-architecture-lets see how this thing works more than any actual real heads down development. So I ignore docker for a while on the old machine until it started getting unwieldy and then I discovered orbstack which seems to be the fun, commonsense way now to run docker locally on your mac.

Last week I got the docker thing running with orbstack again. Opted to start a new 2025 directory in workspace rather than pick apart and figure out what all those old dying project-test investigations all were anyways and got clean and lined up with my host services. We’re running devops again like it was always meant to be.

Tonight I decided to look up that old friend Drupal – long past are the days of setting up localhost multisites with MAMP and enjoying the goodness that is a drush git install. Still trying to get my head around all the automation that comes with using composer to install and now there is the ddev thing that is really really a nice way to run drupal localhosts from the command line. Almost forgot for a time that Orbstack was at lsast there to give some assurance from a GUI standpoint that these containers do in fact exist and look and run like real like out there websites applications.

So, I took a few notes as I went along to make sure I understood what I was doing:

It started with Homebrew:

brew install composer
brew install docker
brew install orbstack

fun, ok tha was mostly already there but just for reference that would be the place to start to get the docker container platform in place. It’s worth taking some time playing around and installing the getting-started package and seeing how docker containers work once again for review. Otherwise, you tend to take for granted that it is there.

brew install ddev/ddev/ddev
# that puts in the ddev package in there - ddev is a launch tool for php dev environments. Gets the launched fast.

mkcert --install
# this puts in a local CA so we don't run into all sorts of authorization issues with the local website. 

OK now to my local wokrspace directory where I am going to set up the local drupal package and code.

ddev start 
composer create-project drupal/recommended-project drupal
ddev composer require drush/drush
ddev drush site:install --account-name=admin --account-pass=admin -y
ddev launch

Here I ran into some issues with getting a 403 nginx message. There’s a real handy command now with ddev that you can use to learn about the internals of this thing

ddev describe

In this case I learned that I did not configure my path to the docroot correctly which is configured in the .ddev/config.yaml file. this config is also read att the ddev start command to basically start up the container and follows the instruction as to what you see as the docroot relative to the root directory where .ddev sits. In the Drupal case, I am looking at the ../web folder as it sits relative to .ddev – so this is a vim edit to the .ddev/config.yaml file

name: drupal-2025
type: drupal
docroot: ./web/
php_version: "8.3"
webserver_type: nginx-fpm
xdebug_enabled: false

actually, running ddev config allows you to set these first few configs, but it’s handly to edit these config files by hand or at least look at them so you see what all the automation fuss is about.
OK now we’re looking like we are ready to roll now!

ddev stop
ddev config
ddev start
ddev launch

And just like that… Drupal on an Orbstack engine for Docker running on mac.

Leave a Reply