How to create a self-hosted analytics dashboard with Metabase and Docker
May 24, 2026
/
Domantas P.
/
9 min Read
To create a self-hosted analytics dashboard with Metabase and Docker, deploy the Metabase container, store its application data in PostgreSQL, connect your business database, and build dashboards from saved questions and visualizations. This setup gives you a private business intelligence environment where you control the server, database connections, users, permissions, and reporting workflow.
Metabase works well for self-hosted analytics because it combines a visual query builder, SQL editor, dashboard filters, scheduled reports, and team permissions in one interface. Docker makes the deployment portable, while PostgreSQL keeps Metabase data such as users, dashboards, saved questions, and settings outside the container.
The fastest setup is to run the official Metabase Docker image and open the setup wizard on port 3000. For long-term reporting, use Docker Compose with PostgreSQL or deploy the Metabase Docker template on Hostinger VPS to reduce manual configuration.
What do you need before installing Metabase with Docker?
Before installing Metabase with Docker, set up the basic private server, database, and access details needed to run the container and complete the setup wizard.
You need:
- A server or local machine with Docker installed.
- Terminal access to run Docker commands.
- An available port for the Metabase web interface. Metabase uses port 3000 by default.
- A PostgreSQL database for long-term Metabase application data, such as users, dashboards, saved questions, permissions, and settings.
- The connection details for the business database you want to analyze, including the host, port, database name, username, and password.
The PostgreSQL application database is different from the business database you connect to analytics. PostgreSQL stores Metabase’s own settings and saved assets, while the connected business database provides the data used to create charts, reports, and dashboards.
How to install Metabase with Docker
You can install Metabase with Docker by pulling the official Metabase image, running it as a container, and opening the setup wizard in your browser. This method is best for testing Metabase or creating a basic self-hosted analytics dashboard before moving to a production setup.
Before starting, make sure Docker is installed on your server or local machine. You also need access to the terminal and an available port, such as 3000, for the Metabase web interface.
1. Pull the official Metabase Docker image
First, download the official Metabase image from Docker Hub:
docker pull metabase/metabase:latest
This command downloads the latest open-source Metabase Docker image to your server. Docker uses this image to create and run the Metabase container.
2. Run the Metabase container
After downloading the image, start Metabase with this command:
docker run -d -p 3000:3000 --name metabase metabase/metabase
Here is what each part of the command does:
- docker run creates and starts a new container.
- -d runs the container in the background.
- -p 3000:3000 maps port 3000 on your server to port 3000 inside the container.
- –name metabase gives the container a readable name.
- metabase/metabase tells Docker which image to use.
Metabase starts on port 3000 by default. If another application already uses this port, map Metabase to a different host port:
docker run -d -p 3001:3000 --name metabase metabase/metabase
With this command, Metabase still uses port 3000 inside the container, but you access it through port 3001 on your server.
3. Check if the Metabase container is running
To confirm that the container started correctly, list your running Docker containers:
docker ps
You should see a container named metabase in the output.
You can also check the Metabase logs:
docker logs -f metabase
Wait until the logs show that Metabase has finished starting. The first launch can take a few minutes because Metabase initializes its application files.
4. Open the Metabase setup wizard
Once the container is running, open Metabase in your browser.
If you installed Metabase on a local machine, go to:
http://localhost:3000
If you installed Metabase on a VPS, use your server IP address:
http://your-server-ip:3000
Replace your-server-ip with the actual IP address of your VPS.
The Metabase setup wizard will ask you to create an admin account, choose your language, and connect your first data source. After completing the setup, you can start creating questions, charts, and dashboards from your business data.
5. Stop or restart the Metabase container
To stop Metabase, run:
docker stop metabase
To start it again, run:
docker start metabase
To restart Metabase after a configuration change, use:
docker restart metabase
This basic Docker setup is useful for testing Metabase, but it is not the best option for production. By default, Metabase uses an embedded application database inside the container. For a long-term business intelligence dashboard, run Metabase with PostgreSQL and Docker Compose so your dashboards, users, settings, and saved questions remain stored safely outside the container.
How to run Metabase with Docker Compose and PostgreSQL
The basic Docker installation works for testing, but a production Metabase setup should use PostgreSQL as the application database. PostgreSQL stores your Metabase users, dashboards, saved questions, settings, and permissions outside the Metabase container, so your analytics workspace remains intact when you update, recreate, or restart the container.
Docker Compose lets you run Metabase and PostgreSQL together from one configuration file. This makes the setup easier to manage than manually starting each container.
1. Create a project directory
First, create a separate directory for your Metabase deployment:
mkdir metabase-docker cd metabase-docker
This directory will store your Docker Compose configuration file.
2. Create a Docker Compose file
Create a new docker-compose.yml file:
nano docker-compose.yml
Then, add the following configuration:
services: postgres: image: postgres:16 container_name: metabase-postgres restart: unless-stopped environment: POSTGRES_DB: metabase POSTGRES_USER: metabase POSTGRES_PASSWORD: change_this_password volumes: - metabase-postgres-data:/var/lib/postgresql/data metabase: image: metabase/metabase:latest container_name: metabase restart: unless-stopped ports: - "3000:3000" environment: MB_DB_TYPE: postgres MB_DB_DBNAME: metabase MB_DB_PORT: 5432 MB_DB_USER: metabase MB_DB_PASS: change_this_password MB_DB_HOST: postgres depends_on: - postgres volumes: metabase-postgres-data:
Replace change_this_password with a strong password before starting the containers. Use the same password for POSTGRES_PASSWORD and MB_DB_PASS, as Metabase uses it to connect to the PostgreSQL database.
3. Start Metabase and PostgreSQL
Run the following command from the same directory as your docker-compose.yml file:
docker compose up -d
Docker Compose will download the required images, create the PostgreSQL database container, and start the Metabase container in the background.
To check if both containers are running, use:
docker compose ps
You should see two services: postgres and metabase.
4. Check the Metabase logs
Metabase can take a few minutes to start during the first launch. Check the logs with:
docker compose logs -f metabase
Wait until the logs show that Metabase has finished initializing. If Metabase cannot connect to PostgreSQL, ensure the database name, username, password, port, and host match across both service configurations.
5. Open Metabase in your browser
After the containers are running, open Metabase in your browser:
http://your-server-ip:3000
Replace your-server-ip with your VPS IP address. If you are running the setup locally, use:
http://localhost:3000
The setup wizard will ask you to create an admin account and configure your first data source. This data source is separate from the PostgreSQL application database used by Metabase itself.
6. Manage the Docker Compose deployment
Use these commands to manage your Metabase deployment:
docker compose stop
This stops the Metabase and PostgreSQL containers.
docker compose start
This starts the containers again.
docker compose restart
This restarts both services.
docker compose down
This stops and removes the containers, but keeps the PostgreSQL volume unless you explicitly remove volumes.
Avoid running docker compose down -v unless you want to delete the PostgreSQL volume. That volume contains your Metabase application data, including dashboards, saved questions, users, and settings.
7. Update Metabase with Docker Compose
To update Metabase, pull the latest image and recreate the container:
docker compose pull metabase docker compose up -d metabase
Docker Compose replaces the Metabase container with a new one using the updated image. Your application data remains stored in the PostgreSQL volume.
Before updating a production Metabase instance, back up your PostgreSQL database. This protects your dashboards, saved questions, permissions, and configuration if the update fails or introduces compatibility issues.
How to deploy Metabase faster with Hostinger VPS
You can deploy Metabase faster with Hostinger VPS by using the ready-made Metabase Docker template, which eliminates the need to manually configure the Docker image, PostgreSQL database, and container settings. This option is better if you want to launch a self-hosted business intelligence dashboard without writing a Docker Compose file.
Hostinger’s Metabase Docker template includes a pre-configured PostgreSQL backend, so Metabase has a reliable place to store application data such as users, dashboards, saved questions, permissions, and settings. This setup gives you control of self-hosting while reducing the manual work needed to prepare the environment.
To deploy Metabase, open Hostinger’s Metabase Docker template page, choose a VPS plan, and complete the setup from hPanel. Hostinger will provision the VPS with the selected Docker template, so you can access Metabase through your server IP address once the deployment is ready:
http://your-server-ip:3000
Replace your-server-ip with the IP address of your VPS. After opening Metabase, complete the setup wizard by creating an admin account, choosing your workspace settings, and connecting your first business data source.
The connected business data source is separate from the PostgreSQL backend included with the template. PostgreSQL stores Metabase’s own application data, while your connected data source stores the business data you want to analyze, such as sales records, product usage data, marketing performance, or customer activity.
After connecting a data source, you can create questions, turn them into charts, and combine those charts into a business intelligence dashboard. For a long-term setup, connect a domain, enable HTTPS, assign user permissions, and regularly back up your Metabase application database.
How to create a business intelligence dashboard in Metabase
After installing Metabase, create a business intelligence dashboard by connecting a data source, asking questions of your data, choosing visualizations, and grouping the results. This workflow turns raw business data into charts, tables, and key performance indicators that teams can use to track performance.
1. Connect your business data source
Start by opening Metabase and clicking Add your data. Choose the database type that stores your business data, such as PostgreSQL, MySQL, MongoDB, BigQuery, or Snowflake.
Then, enter the required connection details, including the database host, port, name, username, and password. After the connection is active, Metabase scans the database schema and makes the available tables searchable from the interface.
The connected data source stores the business data you want to analyze. This is different from the Metabase application database, which stores users, dashboards, saved questions, permissions, and settings.
2. Create your first question
Next, create a question from your connected data source. In Metabase, a question is a saved query that answers a specific business need.
For example, a sales team might ask, “How much revenue did we generate this month?” A marketing team might ask, “Which campaign brought the most signups?” A product team might ask, “How many users activated a feature after signing up?”
You can create questions with the visual query builder or write SQL directly if you need more control over joins, filters, or calculations.
3. Choose the right visualization
After creating a question, choose a visualization that matches the answer.
Use a number chart for a single key metric, such as monthly recurring revenue or total signups. Use a line chart for trends over time, such as daily active users or weekly revenue. Use a bar chart to compare categories, such as revenue by product or leads by campaign. Use a table when users need to inspect individual records or detailed breakdowns.
The visualization should make the answer easier to understand, not just display the data. For example, a line chart is clearer than a table when the main goal is to show whether revenue increased or decreased over time.
4. Add saved questions to a dashboard
After saving several questions, open Dashboards and create a new dashboard. Add the saved questions to the dashboard and arrange them by importance.
Place the most important metrics near the top, such as revenue, conversion rate, active users, or churn. Use the middle and lower sections for supporting charts, such as performance by product, channel, region, or customer segment.
A clear dashboard should address a single business goal. For example, create separate dashboards for sales performance, marketing attribution, product usage, and executive reporting, rather than combining all metrics into a single view.
5. Add dashboard filters
Add filters so users can adjust the dashboard without creating new questions. Common filters include date range, region, product, campaign, customer segment, and account owner.
For example, a date filter lets users switch between daily, weekly, monthly, and quarterly views. A region filter helps managers compare markets. A product filter helps teams analyze performance for a specific service, plan, or feature.
Filters make the same dashboard useful for different teams while keeping the main layout simple.
6. Share the dashboard with your team
Finally, share the dashboard with the users who need access to the metrics. Use permissions to control who can view dashboards, create questions, or access specific databases.
For recurring reporting, schedule email updates or connect team notifications so stakeholders receive key metrics without opening Metabase manually.
Before sharing the dashboard widely, review the layout, filters, and permissions. This helps prevent users from seeing irrelevant data or accessing tables they should not use.
Business intelligence dashboard examples you can build with Metabase
Metabase lets you create different business intelligence dashboards for different teams, data sources, and reporting goals. The best dashboard type depends on the business question you want to answer, such as where revenue comes from, which campaigns drive customer acquisition, or how users interact with your product.
Dashboard type | Main users | Metrics to include |
Sales dashboard | Sales teams and managers | Revenue, closed deals, win rate, pipeline value, average deal size |
Marketing dashboard | Marketing teams | Traffic, leads, signups, conversion rate, customer acquisition cost |
Product dashboard | Product and growth teams | Active users, feature usage, activation rate, retention, churn |
Ecommerce dashboard | Store owners and operations teams | Orders, revenue, average order value, abandoned carts, refund rate |
Customer support dashboard | Support and success teams | Ticket volume, response time, resolution time, satisfaction score |
Executive dashboard | Founders and leadership teams | Revenue, profit margin, growth rate, churn, customer lifetime value |
A sales dashboard helps revenue teams track pipeline health and sales performance. For example, you can connect Metabase to a customer relationship management database and visualize monthly revenue, open opportunities, closed deals, and win rate by sales representative.
A marketing dashboard shows how campaigns turn visitors into leads or customers. For example, you can compare traffic sources, landing page conversion rates, paid campaign performance, and customer acquisition costs in a single view.
A product dashboard helps teams understand user behavior after signup. For example, you can track active users, activation rate, feature adoption, retention, and churn to see which parts of the product create long-term value.
An ecommerce dashboard gives store owners a clear view of sales activity. For example, you can monitor daily orders, revenue by product, average order value, refund rate, and abandoned carts to identify issues in the buying journey.
A customer support dashboard helps support teams manage workload and service quality. For example, you can track ticket volume, first response time, resolution time, backlog, and customer satisfaction score to find bottlenecks in the support process.
An executive dashboard gives leadership a high-level view of business performance. For example, you can combine revenue, churn, customer lifetime value, profit margin, and growth rate into one dashboard for weekly or monthly reporting.
Start with a single dashboard that answers a single business question. Once the first dashboard is useful, create separate dashboards for each team so users can focus on the metrics that affect their decisions.
Next steps for your self-hosted analytics dashboard
After deploying Metabase with Docker, the next step is to make your analytics dashboard reliable, secure, and useful for daily decision-making. Start by moving from a basic container setup to a PostgreSQL-backed deployment if you plan to use Metabase for long-term business reporting.
First, connect the database that contains your most important business data. This can be a sales database, ecommerce database, a product analytics database, a marketing warehouse, or a customer support database. Then, create one focused dashboard around a single business question, such as “Which channels generate the most revenue?” or “How many users become active after signing up?”
Once the first dashboard is useful, improve the setup with filters, permissions, scheduled reports, and regular database backups. Filters help teams analyze specific time periods, regions, products, or campaigns. Permissions keep sensitive data visible only to the right users. Scheduled reports deliver key metrics to stakeholders without requiring them to open Metabase manually.
For production use, connect a domain, enable HTTPS, monitor VPS resources, and back up the PostgreSQL database that stores Metabase’s application data. These steps protect your dashboards, saved questions, users, and settings as your reporting workflow grows.
A self-hosted Metabase dashboard gives you full control over your analytics environment. Docker makes deployments portable, PostgreSQL keeps your Metabase data persistent, and Hostinger VPS gives you a faster way to launch the stack without manually configuring every container.
All of the tutorial content on this website is subject to Hostinger's rigorous editorial standards and values.