How to run migrations when using docker?

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