Mounting Sqlite Database Into Metabase Run on Docker

If you deploy Metabase on Docker, you will by default found a problem to access your sqlite database file which deployed on your local file. This is due to the wrapped container concept of docker which by default separate the container with other local file.

Now I would like to share about how to simply mount the sqlite file so it can be accessed by Metabase. Before continue i would to give disclaimer that this tutorial is pretty straight forward and can be considered as a “noob way”. If you want to deploy public / mission critical project, I suggest you should learn more about docker local directory mounting to ensure security & stability.

  1. I use debian as the server host and I deploy metabase using docker. You can check how to install docker in here and the tutorial to deploy metabase on docker in here 
  2. Let’s assume that you already have a sqlite database, let say it put on /home/project/example.db
  3. by Default, the command to deploy metabase on docker will be like this:
    $ docker run -d -p 3000:3000 –name metabase metabase/metabase
  4. With the command above, there is no mount point for local file which make you can’t access your sqlite file. You can try to deploy and try to access your local file.
  5. So, to ensure the sqlite file can be found, you should put on extra command
    $ docker run -v /home/project:/metabase -d -p 3000:3000 –name metabase metabase/metabase
  6. By putting the command above, you will mount your sqlite folder into metabase container. Then when you start to set up the database in metabase web, you should put the path /metabase/example.db , because your local file mounted in there.

After you completely set up the metabase web, you can try to access your database and start to do the analytic things. Thats all for the tutorial, hopefully this article can help you.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>