Upgrade Metabase on Docker without volume

I initially installed Metabase using the one liner and the H2 database. Since then I have created multiple connections and dashboards. I have also moved my metabase container from one server to another by creating a custom docker image from the running container and moving across machines. How do I upgrade MB version to the latest as I am running container from the custom image I created.

Hi @orangethakkali
Copy the H2 out of the container - example if the container is called metabase:
docker cp metabase:/metabase.db/metabase.db.mv.db ./
Then migrate away from H2:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html
And then start a new container by referencing the new application database:
https://www.metabase.com/docs/latest/operations-guide/running-metabase-on-docker.html#using-postgres-as-the-metabase-application-database

Ran the above command to take the backup and then this, my mysql instance is also running inside docker.

I could not run java command as my installation is pure docker.

docker run --name metabase-migration     -v /opt/metabase:/metabase-data     -e     "MB_DB_FILE=/metabase-data/metabase.db"     -e "MB_DB_TYPE=mysql"     -e "MB_DB_DBNAME=metabase"     -e "MB_DB_PORT=3306"     -e "MB_DB_USER=root"     -e "MB_DB_PASS=<PASSWORD>"     -e "MB_DB_HOST=172.18.0.11"     metabase/metabase load-from-h2
Warning: environ value jdk-11.0.10+9 for key :java-version has been overwritten with 11.0.10
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-04-05 17:09:57,741 INFO metabase.util :: Maximum memory available to JVM: 30.0 GB
2021-04-05 17:10:04,105 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. 🔓
 For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
2021-04-05 17:10:07,516 INFO metabase.core ::
Metabase v0.38.1 (79ef63a release-x.38.x)

Copyright © 2021 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.
2021-04-05 17:10:07,522 WARN metabase.core :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
2021-04-05 17:10:07,555 INFO cmd.copy :: Set up h2 source database and run migrations...
2021-04-05 17:10:07,556 INFO db.setup :: Verifying h2 Database Connection ...
2021-04-05 17:10:07,589 ERROR cmd.copy :: [FAIL]

clojure.lang.ExceptionInfo: ERROR Set up h2 source database and run migrations... {}
        at metabase.cmd.copy$do_step$fn__74686.invoke(copy.clj:33)
        at metabase.cmd.copy$do_step.invokeStatic(copy.clj:29)
        at metabase.cmd.copy$do_step.invoke(copy.clj:27)
        at metabase.cmd.copy$fn__74847$copy_BANG___74852$fn__74853.invoke(copy.clj:262)
        at metabase.cmd.copy$fn__74847$copy_BANG___74852.invoke(copy.clj:255)
        at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:35)
        at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:25)
        at clojure.lang.Var.invoke(Var.java:384)
        at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:45)
        at metabase.cmd$load_from_h2.invoke(cmd.clj:39)
        at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:42)
        at metabase.cmd$load_from_h2.invoke(cmd.clj:39)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.core$apply.invokeStatic(core.clj:665)
        at clojure.core$apply.invoke(core.clj:660)
        at metabase.cmd$run_cmd$fn__74405.invoke(cmd.clj:191)
        at metabase.cmd$run_cmd.invokeStatic(cmd.clj:191)
        at metabase.cmd$run_cmd.invoke(cmd.clj:187)
        at clojure.lang.Var.invoke(Var.java:388)
        at metabase.core$run_cmd.invokeStatic(core.clj:148)
        at metabase.core$run_cmd.invoke(core.clj:146)
        at metabase.core$_main.invokeStatic(core.clj:170)
        at metabase.core$_main.doInvoke(core.clj:165)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at metabase.core.main(Unknown Source)
Caused by: clojure.lang.ExceptionInfo: Unable to connect to Metabase h2 DB. {}
        at metabase.db.setup$fn__34535$verify_db_connection__34540$fn__34541$fn__34542.invoke(setup.clj:102)
        at metabase.db.setup$fn__34535$verify_db_connection__34540$fn__34541.invoke(setup.clj:100)
        at metabase.db.setup$fn__34535$verify_db_connection__34540.invoke(setup.clj:94)
        at metabase.db.setup$setup_db_BANG_$fn__34570$fn__34571.invoke(setup.clj:142)
        at metabase.util$do_with_us_locale.invokeStatic(util.clj:670)
        at metabase.util$do_with_us_locale.invoke(util.clj:656)
        at metabase.db.setup$setup_db_BANG_$fn__34570.invoke(setup.clj:141)
        at metabase.db.setup$setup_db_BANG_.invokeStatic(setup.clj:140)
        at metabase.db.setup$setup_db_BANG_.invoke(setup.clj:136)
        at metabase.cmd.copy$fn__74847$copy_BANG___74852$fn__74853$fn__74854.invoke(copy.clj:263)
        at metabase.cmd.copy$do_step$fn__74686.invoke(copy.clj:30)
        ... 25 more
Caused by: org.h2.jdbc.JdbcSQLException: Invalid database name: "/" [90138-197]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
        at org.h2.message.DbException.get(DbException.java:179)
        at org.h2.message.DbException.get(DbException.java:155)
        at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:404)
        at org.h2.engine.Engine.openSession(Engine.java:50)
        at org.h2.engine.Engine.openSession(Engine.java:179)
        at org.h2.engine.Engine.createSessionAndValidate(Engine.java:157)
        at org.h2.engine.Engine.createSession(Engine.java:140)
        at org.h2.engine.Engine.createSession(Engine.java:28)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:351)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:124)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:103)
        at org.h2.Driver.connect(Driver.java:69)
        at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
        at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
        at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
        at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
        at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
        at clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1111)
        at clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1093)
        at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
        at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
        at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
        at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
        at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invokeStatic(connection.clj:175)
        at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:172)
        at metabase.db.setup$fn__34535$verify_db_connection__34540$fn__34541$fn__34542.invoke(setup.clj:100)
        ... 35 more
Command failed with exception: ERROR Set up h2 source database and run migrations...

Edit: Volume location-v /opt/metabase/bck:/metabase-data \

@orangethakkali But what is the exact location of the H2? You're giving MB_DB_FILE=/metabase-data/metabase.db", but it's probably a lot easier if you figure that out than me guessing if you're running default or not.

location on local FS is/opt/metabase/bck/metabase.db.mv.db
Edit:
After I run the migration command and the error message, the backup file is moved to
/opt/metabase/bck/metabase.db/metabase.db.mv.db. Not sure why this is happening.

@orangethakkali I can only recommend running the migration outside of Docker - it's a one-off process. It's just messy to deal with Docker when migrating.
The path should then be MB_DB_FILE=/metabase-data/metabase.db/metabase.db

okay, if I want to run it on local, from where do I get metabase.jar.

@orangethakkali https://www.metabase.com/start/oss/