Versions discussed: Drupal 8.6.13, Drush 9.6.1.

This is somewhat similar to How to have an environment specific drush.yml? except that the other thread is now four or five months out-of-date and Drush 9.6.1 doesn't seem to respect the drush.yml anymore.

I'm just trying to set my Site URI.

As detailed in that thread, I've tried web/sites/default/drush.yml as well as many other locations for the drush.yml, done a drush cc drush, and yet drush status still reveals an incorrect Site URI of http://default, showing that it is not respecting the uri: line in any of my drush.yml files.

To complicate matters, I'm using DDEV, so following up on some suggestions that I've gotten from the Drupal Slack that we should really be using an environment variable (namely DRUSH_OPTIONS_URI) have proven tricky, as I'm not exactly sure where that goes inside of the DDEV environment.

Inside the DDEV container, if I do export DRUSH_OPTIONS_URI=http://my.ddev.local/ then everything works great, but once I quit the container or try to do things from outside it, such as ddev exec drush uli, things are back to the incorrect Site URI.

How can I persist this environment variable across restarts of DDEV/Docker?

1 Answer 1


I'm writing this up for posterity, since the Slack is relatively ephemeral. Here's the current method, following Providing custom environment variables to a container:

In e.g. .ddev/docker-compose.environment.yml put the following:

version: '3.6'

      - DRUSH_OPTIONS_URI=http://my.ddev.local

Then ddev rm and ddev start to prove to see it working. (This works for drush uli inside the container, after ddev ssh.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.