Metabase on Docker (Windows) — How to run for a dev env and connect to a database
As I’m learning Metabase for work on a project, I decided to make short tutorials that you should know when you use it for the first time as they’re basic steps.
In our first post, I’ll show you how to run Metabase on Docker and connect it to a database.
- Running Metabase
With Docker Desktop running, open the cmd and execute this command:
docker run -d -p 3000:3000 --name metabase metabase/metabaseIf this is your first time using Metabase on Docker, a message telling that it wasn’t possible to find Metabase image locally will be shown, then it’ll search for it, download and create a new container.
You can check that the container was created on the containers/apps list on Docker and, if this is not your first time running Metabase on it, you just need to click on start:
The app will be ready to be used on the link localhost:3000:
Now, let’s connect it to a database.
Please note that production environments require further configuration.
2. Connecting to a database
Click on ‘Admin’ on Configuration:
Select ‘Databases’ and click on ‘Add database’ — as you see, you can also delete a database from the application by clicking on ‘Delete’, but be aware that deleting a database is irreversible and will delete its questions and dashboards as well:
Then, fill the form with the required information (database, name, host, port, user, password etc.). In this tutorial, I’ll be using MySQL.
Is your database not in the list, but it is supported by Metabase (for example, Oracle)? That means you’ll need a driver, but I am going to show that on another post!
Select optional configuration according to your situation and then click on ‘Next’. If your database is too large, it’s recommended that you select this option and choose manually when to sync it:
That’s it, your data have been added and are ready to use!