Docker after upgrade have no old data?

I upgrade docker metabase to the latest version, but the old data does not exists even after I copy the old metabase.db to the new container.

Hi @lee
You should migrate away from H2 if you're using Metabase in production:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html
I don't know how/where you're copying the old H2 database to in the new container, but I'm guessing it's not the correct place or incorrect permissions.
Look at the container logs during startup - that should hint at what is happening.

I use

docker cp [container_id]:/metabase.db host_file_path

copy the h2 database from old container to the host vm file system.

And then I create a new metabase docker instance and bind the docker folder metabase.db with the host vm file path.


 ↙ Load driver :sql took 113.7 ms

2021-08-11 10:20:43,257 INFO driver.impl :: Registered abstract driver :sql-jdbc (parents: [:sql]) 🚚

Load driver :sql-jdbc took 188.2 ms

2021-08-11 10:20:43,262 INFO driver.impl :: Registered abstract driver :hive-like (parents: [:sql-jdbc]) 🚚

2021-08-11 10:20:43,263 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sparksql...

2021-08-11 10:20:43,264 INFO driver.impl :: Registered driver :sparksql (parents: [:hive-like]) 🚚

2021-08-11 10:20:43,274 INFO plugins.dependencies :: Plugin 'Metabase Google Analytics Driver' depends on plugin 'Metabase Google Drivers Shared Dependencies'

2021-08-11 10:20:43,276 INFO plugins.dependencies :: Metabase Google Analytics Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? false

2021-08-11 10:20:43,277 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase Google Analytics Driver"]

2021-08-11 10:20:43,283 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :druid...

2021-08-11 10:20:43,284 INFO driver.impl :: Registered driver :druid  🚚

2021-08-11 10:20:43,289 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :presto...

2021-08-11 10:20:43,290 INFO driver.impl :: Registered driver :presto (parents: [:sql]) 🚚

2021-08-11 10:20:43,297 INFO plugins.dependencies :: Metabase cannot initialize plugin Metabase Oracle Driver due to required dependencies. Metabase requires the Oracle JDBC driver in order to connect to Oracle databases, but we can't ship it as part of Metabase due to licensing restrictions. See https://metabase.com/docs/latest/administration-guide/databases/oracle.html for more details.


2021-08-11 10:20:43,298 INFO plugins.dependencies :: Metabase Oracle Driver dependency {:class oracle.jdbc.OracleDriver} satisfied? false

2021-08-11 10:20:43,298 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase Google Analytics Driver" "Metabase Oracle Driver"]

2021-08-11 10:20:43,311 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :mongo...

2021-08-11 10:20:43,311 INFO driver.impl :: Registered driver :mongo  🚚

2021-08-11 10:20:43,339 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :snowflake...

2021-08-11 10:20:43,340 INFO driver.impl :: Registered driver :snowflake (parents: [:sql-jdbc]) 🚚

2021-08-11 10:20:43,348 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sqlserver...

2021-08-11 10:20:43,349 INFO driver.impl :: Registered driver :sqlserver (parents: [:sql-jdbc]) 🚚

2021-08-11 10:20:43,354 INFO plugins.dependencies :: Metabase cannot initialize plugin Metabase Vertica Driver due to required dependencies. Metabase requires the Vertica JDBC driver in order to connect to Vertica databases, but we can't ship it as part of Metabase due to licensing restrictions. See https://metabase.com/docs/latest/administration-guide/databases/vertica.html for more details.


2021-08-11 10:20:43,355 INFO plugins.dependencies :: Metabase Vertica Driver dependency {:class com.vertica.jdbc.Driver} satisfied? false

2021-08-11 10:20:43,355 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase Google Analytics Driver" "Metabase Vertica Driver" "Metabase Oracle Driver"]

2021-08-11 10:20:43,361 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :redshift...

2021-08-11 10:20:43,374 INFO driver.impl :: Registered driver :postgres (parents: [:sql-jdbc]) 🚚

Load driver :postgres took 24.4 ms

2021-08-11 10:20:43,388 INFO driver.impl :: Registered driver :redshift (parents: [:postgres]) 🚚

2021-08-11 10:20:43,393 INFO plugins.dependencies :: Plugin 'Metabase BigQuery Driver' depends on plugin 'Metabase Google Drivers Shared Dependencies'

2021-08-11 10:20:43,394 INFO plugins.dependencies :: Metabase BigQuery Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? false

2021-08-11 10:20:43,395 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase Google Analytics Driver" "Metabase BigQuery Driver" "Metabase Vertica Driver" "Metabase Oracle Driver"]

2021-08-11 10:20:43,398 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sqlite...

2021-08-11 10:20:43,399 INFO driver.impl :: Registered driver :sqlite (parents: [:sql-jdbc]) 🚚

2021-08-11 10:20:43,403 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :google...

2021-08-11 10:20:43,404 INFO driver.impl :: Registered abstract driver :google  🚚

2021-08-11 10:20:43,405 INFO plugins.dependencies :: Metabase Google Analytics Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? true

2021-08-11 10:20:43,405 INFO plugins.dependencies :: Metabase BigQuery Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? true

2021-08-11 10:20:43,407 DEBUG plugins.initialize :: Dependencies satisfied; these plugins will now be loaded: ["Metabase BigQuery Driver" "Metabase Google Analytics Driver"]

2021-08-11 10:20:43,407 WARN plugins.lazy-loaded-driver :: Warning: plugin manifest for :bigquery does not include connection properties

2021-08-11 10:20:43,408 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :bigquery...

2021-08-11 10:20:43,409 INFO driver.impl :: Registered driver :bigquery (parents: [:sql :google]) 🚚

2021-08-11 10:20:43,410 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :googleanalytics...

2021-08-11 10:20:43,411 INFO driver.impl :: Registered driver :googleanalytics (parents: [:google]) 🚚

2021-08-11 10:20:43,418 INFO driver.impl :: Registered driver :h2 (parents: [:sql-jdbc]) 🚚

2021-08-11 10:20:43,437 INFO driver.impl :: Registered driver :mysql (parents: [:sql-jdbc]) 🚚

2021-08-11 10:20:43,453 INFO metabase.core :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute...

2021-08-11 10:20:43,454 WARN db.env :: WARNING: Using Metabase with an H2 application database is not recommended for production deployments. For production deployments, we highly recommend using Postgres, MySQL, or MariaDB instead. If you decide to continue to use H2, please be sure to back up the database file regularly. For more information, see https://metabase.com/docs/latest/operations-guide/migrating-from-h2.html

2021-08-11 10:20:43,469 INFO db.setup :: Verifying h2 Database Connection ...

2021-08-11 10:20:43,922 INFO db.setup :: Successfully verified H2 1.4.197 (2018-03-18) application database connection. ✅

2021-08-11 10:20:43,922 INFO db.setup :: Running Database Migrations...

2021-08-11 10:20:43,925 INFO db.setup :: Setting up Liquibase...

2021-08-11 10:20:44,004 INFO db.setup :: Liquibase is ready.

2021-08-11 10:20:44,005 INFO db.liquibase :: Checking if Database has unrun migrations...

2021-08-11 10:20:46,230 INFO db.setup :: Database Migrations Current ...  ✅

2021-08-11 10:20:46,262 INFO db.data-migrations :: Running all necessary data migrations, this may take a minute.

2021-08-11 10:20:46,278 INFO db.data-migrations :: Finished running data migrations.

Database setup took 2.8 s

2021-08-11 10:20:46,631 INFO metabase.events :: 开始监听事件 :metabase.events.dependencies/Dependencies 👂

2021-08-11 10:20:46,651 INFO metabase.events :: 开始监听事件 :metabase.events.activity-feed/ActivityFeed 👂

2021-08-11 10:20:46,659 INFO metabase.events :: 开始监听事件 :metabase.events.metabot-lifecycle/MetaBotLifecycle 👂

2021-08-11 10:20:46,660 INFO metabase.events :: 开始监听事件 :metabase.events.last-login/LastLogin 👂

2021-08-11 10:20:46,660 INFO metabase.events :: 开始监听事件 :metabase.events.notifications/Notifications 👂

2021-08-11 10:20:46,661 INFO metabase.events :: 开始监听事件 :metabase.events.sync-database/Sync 👂

2021-08-11 10:20:46,662 INFO metabase.events :: 开始监听事件 :metabase.events.driver-notifications/DriverNotifications 👂

2021-08-11 10:20:46,663 INFO metabase.events :: 开始监听事件 :metabase.events.revision/Revisions 👂

2021-08-11 10:20:46,664 INFO metabase.events :: 开始监听事件 :metabase.events.view-log/ViewLog 👂

2021-08-11 10:20:46,961 INFO metabase.task :: 初始化任务 SyncDatabases 📆

2021-08-11 10:20:47,074 INFO metabase.task :: 初始化任务 CheckForNewVersions 📆

2021-08-11 10:20:47,096 INFO metabase.task :: 初始化任务 SendAnonymousUsageStats 📆

2021-08-11 10:20:47,111 INFO metabase.task :: 初始化任务 SendAbandomentEmails 📆

2021-08-11 10:20:47,137 INFO metabase.task :: 初始化任务 SendPulses 📆

2021-08-11 10:20:47,151 INFO metabase.task :: 初始化任务 SendFollowUpEmails 📆

2021-08-11 10:20:47,163 INFO metabase.task :: 初始化任务 TaskHistoryCleanup 📆

2021-08-11 10:20:47,184 INFO driver.impl :: 初始化驱动 :sql…

2021-08-11 10:20:47,184 INFO driver.impl :: 初始化驱动 :sql-jdbc…

2021-08-11 10:20:47,185 INFO driver.impl :: 初始化驱动 :h2…

2021-08-11 10:20:47,212 INFO metabase.core :: Metabase初始化完成

2021-08-11 10:21:11,897 INFO i18n.impl :: Reading available locales from locales.clj...

2021-08-11 10:21:13,399 DEBUG middleware.log :: GET /api/session/properties 200 29.8 ms(2个数据库调用) 应用数据库连接:0 / 4 码头线程:5 / 50(2空闲,0排队) (42个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:13,753 DEBUG middleware.log :: GET /api/user/current 200 400.8 ms(3个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:13,835 DEBUG middleware.log :: GET /api/database 200 33.0 ms(4个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(3空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:14,056 DEBUG middleware.log :: GET /api/collection/root/items 200 195.3 ms(4个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(3空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:14,139 DEBUG middleware.log :: GET /api/collection/root 200 14.8 ms(2个数据库调用) 应用数据库连接:0 / 4 码头线程:5 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:14,259 DEBUG middleware.log :: GET /api/collection/root/items 200 34.2 ms(4个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:14,333 DEBUG middleware.log :: GET /api/database 200 8.2 ms(3个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:14,973 DEBUG middleware.log :: GET /api/automagic-dashboards/database/1/candidates 200 613.5 ms(6个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:28,860 DEBUG middleware.log :: GET /api/user/current 200 5.8 ms(3个数据库调用) 应用数据库连接:1 / 4 码头线程:5 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:28,868 DEBUG middleware.log :: GET /api/session/properties 200 14.8 ms(2个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:28,913 DEBUG middleware.log :: GET /api/database 200 7.6 ms(3个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:28,954 DEBUG middleware.log :: GET /api/collection/root/items 200 16.4 ms(4个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(2空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:29,054 DEBUG middleware.log :: GET /api/collection/root 200 5.1 ms(2个数据库调用) 应用数据库连接:0 / 4 码头线程:7 / 50(1空闲,0排队) (43个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:29,237 DEBUG middleware.log :: GET /api/collection/root/items 200 26.4 ms(4个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(1空闲,0排队) (44个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:29,309 DEBUG middleware.log :: GET /api/database 200 6.7 ms(3个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(1空闲,0排队) (44个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:29,354 DEBUG middleware.log :: GET /api/automagic-dashboards/database/1/candidates 200 18.6 ms(6个数据库调用) 应用数据库连接:0 / 4 码头线程:4 / 50(1空闲,0排队) (44个活动线程总数) 进行中的查询:0 (0已排队)

2021-08-11 10:21:37,324 DEBUG middleware.log :: GET /api/setting 200 4.1 ms(0个数据库调用) 应用数据库连接:0 / 4 码头线程:5 / 50(1空闲,0排队) (44个活动线程总数) 进行中的查询:0 (0已排队)

@lee

So you were not binding on the old container?
Can you see the H2 database, when you copy the directory out?
Post ls -l host_file_path

And I have no idea how you're binding in the new container, so if you actually copied the files out, then perhaps you're not binding correctly or perhaps referencing something incorrect.

Without more details it's not possible to know what's going on.

I would absolutely recommend that you do not use H2. You should migrate away.

Thank you for your advise for migrating away! I am now just learn metabase, have not yet deploy it to the production environment. After I am familar with it, I will follow the best practice.

Now I solve the problem! Maybe I bind a wrong path to the container.