How to shutdown Metabase in Docker?

I am trying to move h2 db to external database, am running docker. The instructions say to shut down Metabase. How do I do this? I tried to kill the process while inside the container with kill and kill -9, both don’t work (Metabase is still running).

ps -A shows me that java is running as root process (pid 1). So when I kill pid 1 I drop out of the container, because I killed the root process.

Maybe I have to re-phrase my question: Is there any documentation on how to move app db to external db on docker? Maybe I’m just approaching this completely wrong.

Thanks

Hi @amsam
Just try to copy the database, when no-one is using Metabase and it’s not sync’ing. Watch the log /var/log/metabase to make sure there’s no activity when you copy the database.
Then do the migration on a test system - if it works, then great, if it fails, then look in the log of the migration.
Don’t migrate and upgrade at the same time. Make sure you’re migrating to the same version.

@amsam It’s a little trickier when running in Docker, health monitoring is making sure the app is running whenever the container is spun up etc. so if you got your data trapped inside the container the other methods you tried it trips you up.

But I believe you you are looking for should be in the :blue_book: Docker chapter either the Getting your config back if you stopped your container or maybe in particular Copying the application database sections should be helpful in your case.

2 Likes

You could try to run docker cp <container_id>:<source>:<destination> command to copy the H2 database ouside your container when nobody is using Metabase (see this documentation) and stop the container after its safe, using docker stop <containter_id>. To know which container you’ll have to run commands, list all of them with docker ps.