---
title: "Deploy Metabase Docker"
description: "official Metabase image on Railway"
category: "Analytics"
url: https://railway.com/deploy/metabase-docker
---

# Deploy Metabase Docker

official Metabase image on Railway

**[Deploy Metabase Docker on Railway](https://railway.com/template/metabase-docker)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/metabase-docker/manifest.json

- **Creator:** onepush
- **Category:** Analytics

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### metabase/metabase

- **Image:** metabase/metabase
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted Metabase Docker (Open-Source BI) on Railway

Running Metabase in Docker is easy until the default H2 database vanishes on redeploy. This guide pins the official image to Postgres on Railway so dashboards, users, and settings survive upgrades instead of disappearing with the container.

## About Hosting Metabase Docker open-source software on Railway (self hosted Metabase template)

The container is the JVM process that serves the UI, runs queries, and renders charts. Durable state—dashboards, saved questions, permissions, connection metadata—lives in an application database. The stock image with no env vars uses H2 inside the container filesystem. That works for a demo, but Railway wipes it on rebuild.

This template wires metabase/metabase to a companion Postgres service. Port 3000 serves the web UI; health check GET /api/health returns 200 only after migrations finish. First boot creates the schema and drops you into the setup wizard to create an admin user. Then you add warehouse databases—Postgres, MySQL, BigQuery, Snowflake, Redshift, MongoDB—via Admin → Databases.

## Why Deploy Metabase Docker, the Tableau alternative on Railway (Railway Free Trial)

Tableau is excellent if you have procurement, a BI admin, and a five-figure budget. Most small teams have none of those. Metabase gives the core loop—connect a database, write SQL or use the visual builder, build a dashboard, share a link—without the sales call. The OSS is AGPL and free on your own infra. Railway removes VPS setup; the $5 GitHub trial covers a small instance.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Metabase Docker on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for Metabase Docker self hosting

| Provider | What you get | Ops overhead | Good for |
|---|---|---|---|
| DigitalOcean | Droplet or App Platform | You manage OS, Docker, proxy, backups | Linux-comfortable teams |
| AWS | EC2, RDS, ECS, IAM, VPC | Highest, even with Copilot | Enterprises already in AWS |
| Hetzner | Cheap VPS | Same as DO | Cost-sensitive EU deployments |
| Railway | Managed container + Postgres, built-in TLS | Minimal; set env vars and health checks | Small teams wanting BI, not infra |

DigitalOcean and Hetzner give raw compute but you own Docker upgrades, backups, and reverse proxy config. AWS gives every knob and expects you to turn them all; Railway manages the host.

## Common Use Cases for hosted Metabase Docker

Internal dashboards are the default: connect a read replica and build signup, activation, and churn charts. Finance pulls billing data; support tracks tickets. Metabase fits analysts who think in joins and managers who think in drag-and-drop.

Ad hoc SQL for engineers: grant read-only Metabase access instead of direct DB credentials; query timeout and pooling prevent runaway queries. For embedding, basic iframe works in OSS; Pro adds interactive embed, SSO, and row-level security.

## Dependencies for Metabase Docker hosted on Railway

The stack is one app container plus Postgres; the gotchas are all in environment variables.

### Deployment Dependencies for Managed Metabase Docker Service (Business Intelligence)

Production app DB must be Postgres, not H2. Companion service uses ghcr.io/railwayapp-templates/postgres-ssl (v17). Attach a volume or you recreate the H2 problem. Set these on the Metabase service:

- MB_DB_TYPE=postgres
- MB_DB_HOST — internal Railway hostname of Postgres
- MB_DB_PORT=5432
- MB_DB_USER and MB_DB_PASS — dedicated app DB credentials
- MB_DB_DBNAME — database for Metabase schema

### Implementation Details for Metabase Docker (Using Metabase official docker image)

Pin the tag like metabase/metabase:v0.63.x, not latest. Migrations are one-way; booting a newer version against your app DB cannot be rolled back by changing the tag.

MB_ENCRYPTION_SECRET_KEY encrypts stored DB credentials. If it changes between deploys, Metabase cannot decrypt settings and connected databases appear broken. Generate a long random string once, keep it stable. MB_SITE_URL must be the public HTTPS URL for links, embeds, and emails.

Set JAVA_TOOL_OPTIONS=-Xmx2g for large dashboards; the container needs more RAM than the heap. Health check /api/health returns 503 until ready.

## How does Metabase Docker compare against other Business Intelligence platforms

Metabase lands on the accessible end, but it's not right for every team.

### Metabase Docker vs Tableau (Tableau Alternative)

Tableau wins on visual polish and governance, but Desktop is licensed, Server is expensive, and Cloud has per-user fees. Metabase's visual builder is less flexible but a non-technical user can create a question in minutes—pragmatic for a 20-person startup.

### Metabase Docker vs Power BI (Power BI Alternative)

Power BI integrates with Excel, Azure, Teams, SharePoint; per-user Pro pricing is hard to beat if you live in Microsoft 365. Metabase has no Office integration but wins on self-hosting and a friendlier SQL editor.

### Metabase Docker vs Apache Superset (Apache Superset Alternative)

Superset has richer charts and better SQL Lab but needs multiple containers (web, worker, Redis, Postgres, possibly Celery). Metabase's single-container Docker is simpler; a data platform team may prefer Superset, a two-person team gets to dashboards faster with Metabase.

### Metabase Docker vs Redash (Redash Alternative)

Redash is SQL-first and simpler for pure query runners with scheduled refreshes and alerts. Metabase adds a visual builder for non-SQL users and more polish; Redash development slowed after Databricks acquisition. Metabase ships regularly and covers more ground.

## How to use Metabase Docker (the OSS Business Intelligence)?

First boot wizard creates the admin account, then Admin → Databases to add your first data source—a warehouse DB, not the app DB. Use the visual query builder or SQL editor; save questions, assemble dashboards, add filters, schedule subscriptions, and share via link or embed. Row-level permissions exist but granularity depends on OSS vs paid tier.

## How to self host Metabase Docker on other VPS Services (Metabase Docker self hosting guide)

Manual sequence shows what Railway automates.

### Clone the Repository

Production uses the Docker image, not source. Pull metabase/metabase:v0.63.x; source clone optional but building requires Leiningen, Node, and patience.

### Install Dependencies

Install Docker and Postgres. Create a dedicated database and user for Metabase—not the Postgres superuser. Use a managed DB or a container with a volume.

### Configure Environment Variables

Set MB_DB_TYPE, MB_DB_HOST, MB_DB_PORT, MB_DB_USER, MB_DB_PASS, MB_DB_DBNAME, MB_ENCRYPTION_SECRET_KEY, and MB_SITE_URL. MB_SITE_URL should be the public VPS URL with scheme.

### Start the Metabase Docker Application

Run docker run -d -p 3000:3000 --env-file .env metabase/metabase:v0.63.x. Put Caddy or nginx in front for TLS. Caddy handles Let's Encrypt automatically and proxies port 3000. Watch logs on first boot, then open the wizard.

## Official Pricing of Metabase Docker (Metabase Docker pricing)

Metabase OSS is free under AGPL, no user or dashboard limits, no trial expiration. Cloud Starter runs ~$85/month plus per-user fees; Pro adds SSO, RLS, interactive embed, and audit at significantly higher cost.

## Metabase Docker cloud vs self hosted comparison (Pricing, features, costs, and more)

Cloud means you never touch Docker, JVM flags, or Postgres migrations; you pay per user and data flows through Metabase infra. Self-host on Railway means you own the instance, data stays in your databases, and recurring cost is compute only.

### Monthly cost of self hosting Metabase Docker on Railway

Small Metabase + Postgres typically lands $5–15/month on Hobby; Railway bills per resource-hour, so idle costs less. The $5 GitHub trial covers experiments. Cloud Starter at ~$85/month plus per-user makes self-host compelling under ~20 users.

### System Requirements for Hosting Metabase Docker on a VPS

Metabase is a JVM app; it wants RAM. Light usage: 2 GB RAM, 1 vCPU, heap -Xmx1g. Moderate: 4 GB RAM, -Xmx2g. Disk: 10 GB for the Postgres volume. No multi-node OSS cluster; scale vertically, not horizontally.

## Frequently Asked Questions (FAQs)

### Can I use the H2 database that ships with the Metabase Docker image?

Only for demos. H2 lives in the container filesystem and is wiped on redeploy. Production needs Postgres as the app DB. The Railway template wires this up.

### How do I upgrade the Metabase Docker image without losing data?

Pin current tag, back up Postgres, change tag, redeploy. Migrations run automatically. On failure, restore backup and revert tag. Don't skip major versions.

### What happens if I change the encryption secret key?

Stored DB credentials become unreadable. Generate once, store safely, never rotate casually. Losing it means reconnecting every database from scratch.

### How much JVM memory should I give Metabase?

Start -Xmx1g for light use, 2g for moderate. Watch logs for OutOfMemoryError. Container needs ~50% more RAM than heap for off-heap operations.

### Does the open-source Metabase support embedded dashboards in my own app?

Basic iframe embedding works in OSS. Interactive embed, SSO, and RLS require Pro. Factor Pro pricing before committing to self-host.

### Is Railway cheaper than running Metabase on my own VPS?

Raw Hetzner VPS at €4/month is cheaper in dollars, but you own updates, backups, TLS, and pages. Railway costs a few dollars more and removes most toil. Worth it for small teams without DevOps.


## Similar templates

- [Typesense PHP](https://railway.com/deploy/typesense-php) — official PHP client against Railway
- [Typesense vs Meilisearch](https://railway.com/deploy/typesense-vs-meilisearch) — self-hosted Typesense vs Meilisearch
- [Matomo Analytics + MariaDB](https://railway.com/deploy/matomo-analytics-mariadb) — Privacy-friendly analytics with MariaDB and persistent volumes.

Open this page in a browser: https://railway.com/deploy/metabase-docker
