diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index cc68937..c886a70 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -104,7 +104,7 @@ class Drupal {
    * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
    *   A new container instance to replace the current.
    */
-  public static function setContainer(ContainerInterface $container) {
+  public static function setContainer(ContainerInterface $container = NULL) {
     static::$container = $container;
   }
 
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index e869b9f..d3bee7c 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -44,12 +44,11 @@ public static function getInfo() {
   /**
    * {@inheritdoc}
    */
-  protected function tearDown() {
-    parent::tearDown();
-    if (\Drupal::getContainer()) {
-      $container = new ContainerBuilder();
-      \Drupal::setContainer($container);
-    }
+  protected function setUp() {
+    parent::setUp();
+    // Ensure that an instantiated container in the global state of \Drupal from
+    // a previous test does not leak into this test.
+    \Drupal::setContainer(NULL);
   }
 
   /**
