I am setting up a local site for development on a ubuntu server 18.04 VM. I pull our repo into my windows machine and then mount this onto the VM as a shared folder. I run composer install and it finishes completely, but when I go to my site's docroot folder and run drush st or drush cr, I get the following error message:

RuntimeException: Drush::$container is not initialized yet. \Drush::setContainer() must be called with a real container. in Drush\Drush::getContainer() (line 151 of /media/sf_anothercnas2/vendor/drush/drush/src/Drush.php).
Drush command terminated abnormally due to an unrecoverable error.

Drupal installation went through successfully. In my composer.json, I have "drush/drush": "9.7.2"

Composer show confirms that the local drush version installed is 9.7.2 but when I run drush --version, it returns 8.1.16

  • So you have a globally installed Drush 8, and a locally installed Drush 9. Either replace the globally installed Drush by Drush Launcher or execute the local Drush directly as in vendor/drush/drush/drush cr or add the local vendor/bin to the container's PATH.
    – leymannx
    Commented Apr 1, 2021 at 5:58
  • yeah, running vendor/drush/drush/drush did the trick. I'll look into updating Global drush. thanks!
    – kcsting
    Commented Apr 1, 2021 at 15:43

1 Answer 1


I still am not sure why I'm getting the RuntimeException, but I can work around this issue by running

vendor/drush/drush/drush st //or any other drush 9 commands

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.