diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
index 4d0f9fe..6a71db4 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
@@ -176,6 +176,10 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
       'value'    => Crypt::randomBytesBase64(55),
       'required' => TRUE,
     );
+    $settings['settings']['container_yamls'][0] = (object) array(
+      'value'    => "__DIR__ . '/services.yml'",
+      'required' => TRUE,
+    );
     // Remember the profile which was used.
     $settings['settings']['install_profile'] = (object) array(
       'value' => $install_state['parameters']['profile'],
diff --git a/core/modules/system/src/Tests/Installer/InstallerEmptySettingsTest.php b/core/modules/system/src/Tests/Installer/InstallerEmptySettingsTest.php
index 63bb9a8..72ddef2 100644
--- a/core/modules/system/src/Tests/Installer/InstallerEmptySettingsTest.php
+++ b/core/modules/system/src/Tests/Installer/InstallerEmptySettingsTest.php
@@ -31,6 +31,13 @@ protected function setUp() {
   public function testInstaller() {
     $this->assertUrl('user/1');
     $this->assertResponse(200);
+
+    // Trigger a container rebuild by installing a module. This will break if
+    // the settings file lacks configuration required by the Drupal kernel.
+    $edit = array();
+    $edit['modules[Core][action][enable]'] = 'action';
+    $this->drupalPostForm('admin/modules', $edit, t('Install'));
+    $this->assertResponse(200);
   }
 
 }
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index e3e76ad..8702ab4 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -630,7 +630,7 @@
 /**
  * Load services definition file.
  */
-$settings['container_yamls'][] = __DIR__ . '/services.yml';
+$settings['container_yamls'][0] = __DIR__ . '/services.yml';
 
 /**
  * Override the default service container class.
diff --git a/sites/example.settings.local.php b/sites/example.settings.local.php
index 34b4e19..7e2367a 100644
--- a/sites/example.settings.local.php
+++ b/sites/example.settings.local.php
@@ -32,7 +32,7 @@
 /**
  * Enable local development services.
  */
-$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
+$settings['container_yamls'][0] = DRUPAL_ROOT . '/sites/development.services.yml';
 
 /**
  * Show all error messages, with backtrace information.
