diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index d722d6b..5e9f63f 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -558,11 +558,7 @@ public function discoverServiceProviders() {
       }
     }
     if ($container_yamls = Settings::get('container_yamls')) {
-      $this->serviceYamls['site'] = $container_yamls;
-    }
-    $site_services_yml = $this->getSitePath() . '/services.yml';
-    if (file_exists($site_services_yml) && is_readable($site_services_yml)) {
-      $this->serviceYamls['site'][] = $site_services_yml;
+      $this->serviceYamls['site'] = array_filter($container_yamls, 'file_exists');
     }
   }
 
diff --git a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php
index 59ee3f3..9d99322 100644
--- a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php
+++ b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php
@@ -20,6 +20,7 @@ class DrupalKernelSiteTest extends KernelTestBase {
    * Tests services.yml in site directory.
    */
   public function testServicesYml() {
+    $this->settingsSet('container_yamls', [$this->siteDirectory . '/services.yml']);
     $this->assertFalse($this->container->has('site.service.yml'));
     // A service provider class always has precedence over services.yml files.
     // KernelTestBase::buildContainer() swaps out many services with in-memory
diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
new file mode 100644
index 0000000..86d58c3
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\DrupalKernel\DiscoverServiceProvidersTest.
+ */
+
+namespace Drupal\Tests\Core\DrupalKernel;
+
+use Drupal\Core\DrupalKernel;
+use Drupal\Core\Site\Settings;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\DrupalKernel
+ * @group DrupalKernel
+ */
+class DiscoverServiceProvidersTest extends UnitTestCase {
+
+  /**
+   * Tests discovery with user defined container yaml.
+   *
+   * @covers ::discoverServiceProviders()
+   */
+  public function testDiscoverServiceCustom() {
+    new Settings(array(
+      'container_yamls' => array(
+        __DIR__ . '/fixtures/custom.yml'
+      ),
+    ));
+
+    $kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
+    $kernel->discoverServiceProviders();
+
+    $expect = array(
+      'app' => array(
+        'core' => 'core/core.services.yml',
+      ),
+      'site' => array(
+        __DIR__ . '/fixtures/custom.yml',
+      ),
+    );
+
+    $this->assertAttributeSame($expect, 'serviceYamls', $kernel);
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/fixtures/custom.yml b/core/tests/Drupal/Tests/Core/DrupalKernel/fixtures/custom.yml
new file mode 100644
index 0000000..3950896
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/DrupalKernel/fixtures/custom.yml
@@ -0,0 +1,3 @@
+parameters:
+  test.config:
+    test: true
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index 7cc10be..8a3dfa4 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -595,6 +595,11 @@
 # $config['system.performance']['fast_404']['html'] = '<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>';
 
 /**
+ * Load services definition file.
+ */
+$settings['container_yamls'][] = __DIR__ . '/services.yml';
+
+/**
  * Load local development override configuration, if available.
  *
  * Use settings.local.php to override variables on secondary (staging,
