[Docker] : Stop metabase without stopping the container


I would like to backup the H2 database file on my docker instance.

The documentation recommends to stop the metabase before any backup to avoid locking problems.

But I don’t know how to stop the metabase instance without stopping the container itself.
Is there a way to do this ?

Thanks for your help :slight_smile:

The file should be in your mounted directory. I’d suggest finding it on the host system first, and verify you know where it is. Then stop the container, and back up the file.

Unfortunately I have started my container without mounted volume.

docker run -d -p 3000:3000 --name metabase metabase/metabase

Although, my aim, is to use this backup to switch on a container with a mounted volume without lost all my data…


It sounds like you can use docker cp to copy a file from a Docker container, but I haven’t tried this yet. http://unix.stackexchange.com/questions/122689/pull-a-file-from-a-docker-container

You might be able to use docker attach to get a shell to stop Metabase http://askubuntu.com/questions/505506/how-to-get-bash-or-ssh-into-a-running-container-in-background-mode

Thanks Tom the docker cp command made the job!

I have saved my file “/metabase.db.h2.db” on my host and successfully started a new container with this file on a mounted volume!

No need to stop the metabase instance to copy the H2 file (I haven’t encoutered any lock problems).

Thanks fo your help!