How to run migrations when using docker?

I am upgrading a metabase/mariadb stack from 0.23.1 to >> 0.24 (way to go guys :tada: :slight_smile: )
Metabase is stuck on database migration and complains:

Database has migration lock; cannot run migrations. You can force-release these locks by running `java -jar metabase.jar migrate release-locks.

Docker of course then kills the process. How should I do?

I am trying to upgrade to 0.24, too, and I am having same problem.
Linux, Mysql. Not docker specifically.

It actually first says that the table is already present and I’ve run like it is suggested (migrate release-locks), but then it is stuck on Liquibase is ready…

On next start, new table problem.

I don’t want to do another migrate release-locks, because i will probably need to do that for all the tables.

there are two things to know about this

  1. in 0.24.0 there is a bug that caused the migrations to fail when using MariaDB and MySQL. this is likely why the migration lock was left intact. the fix for this is lined up for 0.24.1 and the workaround is in this issue: https://github.com/metabase/metabase/issues/5073

  2. How to run extra commands like releasing the migration locks and other things through docker. Here is an example of starting the MB container into a bash shell and then then running the jar with a command to clear the locks. This method can be used for general exploration of the container as well. In this case I’m linking to a container called mariadb to connect to the DB, You would want to change the -e ... options to match how you connect MB to your DB.

~ » docker run -ti --link mariadb -e MB_DB_TYPE=mysql  -e MB_DB_DBNAME=metabase -e MB_DB_PORT=3306 -e MB_DB_USER=root -e MB_DB_PASS=metabase -e MB_DB_HOST=mariadb -p 3030:3000 --entrypoint /bin/bash metabase/metabase:v0.24.0  
bash-4.3# cd /app
bash-4.3# java -jar metabase.jar migrate release-locks

1 Like