diff --git a/core/lib/Drupal/Core/Command/DbImportCommand.php b/core/lib/Drupal/Core/Command/DbImportCommand.php
index d7a63b2690..b6708cd0df 100644
--- a/core/lib/Drupal/Core/Command/DbImportCommand.php
+++ b/core/lib/Drupal/Core/Command/DbImportCommand.php
@@ -55,6 +55,15 @@ protected function execute(InputInterface $input, OutputInterface $output) {
   protected function runScript(Connection $connection, $script) {
     $old_key = Database::setActiveConnection($connection->getKey());
 
+    // If the database script contains schema for the cache_container table,
+    // the import will fail because that cache table is created as part of the
+    // normal bootstrapping process, which means that it will exist by the time
+    // this command is run, which will raise a SchemaObjectExistsException. By
+    // destroying the cache bin now, we guarantee that either the database
+    // script will recreate it, or it will be automatically recreated during the
+    // bootstrapping of the next request.
+    \Drupal::cache('container')->removeBin();
+
     if (substr($script, -3) == '.gz') {
       $script = "compress.zlib://$script";
     }
diff --git a/core/modules/system/tests/src/Kernel/Scripts/DbImportCommandTest.php b/core/modules/system/tests/src/Kernel/Scripts/DbImportCommandTest.php
index 8a292e502d..bef1420b25 100644
--- a/core/modules/system/tests/src/Kernel/Scripts/DbImportCommandTest.php
+++ b/core/modules/system/tests/src/Kernel/Scripts/DbImportCommandTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\system\Kernel\Scripts;
 
+use Drupal\Core\Cache\NullBackend;
 use Drupal\Core\Command\DbImportCommand;
 use Drupal\Core\Database\Database;
 use Drupal\KernelTests\KernelTestBase;
@@ -57,6 +58,10 @@ public function testDbImportCommand() {
     ];
     Database::addConnectionInfo($this->databasePrefix, 'default', $connection_info);
 
+    // DbImportCommand will attempt to destroy the container cache bin before
+    // import, so we need to make sure that cache bin is defined.
+    $this->container->set('cache.container', new NullBackend('container'));
+
     $command = new DbImportCommand();
     $command_tester = new CommandTester($command);
     $command_tester->execute([
