8 – No connection to database after project change!

I have set up several projects on my local computer, all projects run in docker containers.
Here are the projects:


For a while I worked on the project drupal_projekt_AB.
After switching to the project drupal_projekt_1 I can’t get a database connection in the container!

With command drush status the following output:

wodby@php.container:/var/www/html $ drush status
<em class="placeholder">Notice</em>: Undefined index: DB_HOST in <em class="placeholder">require()</em> (line <em class="placeholder">9</em> of <em class="placeholder">/var/www/html/environments/docker/drupal/settings.local.php</em>). <pre class="backtrace">require(&#039;/var/www/html/environments/docker/drupal/settings.local.php&#039;) (Line: 29)
require(&#039;/var/www/html/docroot/sites/default/settings.php&#039;) (Line: 125)
DrupalCoreSiteSettings::initialize(&#039;/var/www/html/docroot&#039;, &#039;sites/default&#039;, Object) (Line: 1073)
DrupalCoreDrupalKernel-&gt;initializeSettings(Object) (Line: 275)
DrupalCoreDrupalKernel::createFromRequest(Object, Object, &#039;prod&#039;, 1) (Line: 220)
DrushBootDrupalBoot8-&gt;bootstrapDrupalConfiguration(Object, NULL) (Line: 293)
DrushBootBootstrapManager-&gt;doBootstrap(3, 6, NULL) (Line: 493)
DrushBootBootstrapManager-&gt;bootstrapMax(6) (Line: 427)
DrushBootBootstrapManager-&gt;bootstrapToPhaseIndex(-2, Object) (Line: 396)
DrushBootBootstrapManager-&gt;bootstrapToPhase(&#039;max&#039;, Object) (Line: 28)
DrushBootBootstrapHook-&gt;initialize(Object, Object) (Line: 34)
ConsolidationAnnotatedCommandHooksDispatchersInitializeHookDispatcher-&gt;callInitializeHook(Object, Object, Object) (Line: 27)
ConsolidationAnnotatedCommandHooksDispatchersInitializeHookDispatcher-&gt;initialize(Object, Object) (Line: 145)
ConsolidationAnnotatedCommandCommandProcessor-&gt;initializeHook(Object, Array, Object) (Line: 289)
ConsolidationAnnotatedCommandAnnotatedCommand-&gt;initialize(Object, Object) (Line: 221)
SymfonyComponentConsoleCommandCommand-&gt;run(Object, Object) (Line: 1005)
SymfonyComponentConsoleApplication-&gt;doRunCommand(Object, Object, Object) (Line: 255)
SymfonyComponentConsoleApplication-&gt;doRun(Object, Object) (Line: 148)
SymfonyComponentConsoleApplication-&gt;run(Object, Object) (Line: 118)
DrushRuntimeRuntime-&gt;doRun(Array, Object) (Line: 49)
DrushRuntimeRuntime-&gt;run(Array) (Line: 72)
require(&#039;/var/www/html/vendor/drush/drush/drush.php&#039;) (Line: 18)
drush_main() (Line: 143)
require(&#039;phar:///usr/local/bin/drush/bin/drush.php&#039;) (Line: 14)
</pre> Drupal version : 8.9.16
 Site URI       : http://default
 DB driver      : mysql
 DB port        : 3306
 DB username    : drupal
 DB name        : drupal
 PHP binary     : /usr/local/bin/php
 PHP config     : /tmp/aknBEn
 PHP OS         : Linux
 Drush script   : /usr/local/bin/drush
 Drush version  : 9.7.3
 Drush temp     : /tmp
 Drush configs  : /var/www/html/vendor/drush/drush/drush.yml
 Drupal root    : /var/www/html/docroot
 Site path      : sites/default
wodby@php.container:/var/www/html $

If I shut down the container in project drupal_project_1, I switch to project drupal_project_AB, run container up, the command drush status:

wodby@php.container:/var/www/html $ drush st
 Drupal version   : 8.9.16
 Site URI         : http://default
 DB driver        : mysql
 DB hostname      : mariadb
 DB port          : 3306
 DB username      : drupal
 DB name          : drupal
 Database         : Connected
 Drupal bootstrap : Successful
 Default theme    : AB_seven
 Admin theme      : AB_seven
 PHP binary       : /usr/local/bin/php
 PHP config       :
 PHP OS           : Linux
 Drush script     : /usr/local/bin/drush
 Drush version    : 9.7.2
 Drush temp       : /tmp
 Drush configs    : /var/www/html/vendor/drush/drush/drush.yml
 Install profile  : default
 Drupal root      : /var/www/html/docroot
 Site path        : sites/default
 Files, Public    : sites/default/files
 Files, Private   : ../private
 Files, Temp      : /tmp
wodby@php.container:/var/www/html $

I get normal status, all ok.

To test whether the data in the project drupal_project_1 arrives at the configuration information from the file .env at the file

echo "nnenv: ".print_r( $_ENV, true )."nn";

I did the following output:

env: Array

Unfortunately, the variable was empty!

Does anyone have an idea why after switching from project drupal_project_AB to drupal_project_1 I don’t get a database connection?

The whole thing happened virtually from one moment to the next