Running Metabase on Docker in production: when a container setup fits
A container setup fits a team that wants Metabase running on infrastructure it controls, with images pinned, configuration held in code and the application database kept outside the container. Metabase is available as an open source edition under the AGPL, and its commercial editions ship under the Metabase Commercial Software License from the same repository. For deployment, the split matters in one way: the open source edition runs on Docker without a license key, but features such as SSO, row and column permissions and usage auditing sit in the paid Pro and Enterprise plans. Confirm which plan covers each control you need before you design the container around it.
The Docker guide's Compose example is a starting point for trying Metabase, not a production template. It uses the embedded H2 application database, which stores Metabase's own configuration, users and saved content in a file inside the container. H2 is meant for demos. For production, point the container at an external PostgreSQL application database through the MB_DB_TYPE, MB_DB_HOST, MB_DB_PORT, MB_DB_DBNAME, MB_DB_USER and MB_DB_PASS variables. If you already run Metabase on H2, the migrating from H2 documentation describes the one-time load command, which must be run with the same Metabase version that last wrote the H2 file.
Before you commit to containers, check that your team can own the parts Docker does not manage: the PostgreSQL instance and its backups, secret injection, image updates and the upgrade procedure, which runs database migrations automatically. Ask whether your platform team already operates PostgreSQL and a container runtime that meets your change control rules. If not, a systemd install or a managed hosting option may fit better, and the sibling topics cover those paths.
Configuration options and when each fits
This table compares the main production choices for a Docker-hosted Metabase: application database, image tag, secret handling, configuration persistence and container count. Read each row for the condition that makes an option fit and the trade-off you accept by choosing it. The main takeaway is that embedded H2 is for demos only, and that an external PostgreSQL database with a pinned LTS tag is the baseline most production teams start from.
| Choice | Option | When it fits and the trade-off |
|---|---|---|
| Application database | Embedded H2 | Demos and evaluation only. Metabase ships H2 for trial use and recommends PostgreSQL for production, so plan a move before go-live. |
| Application database | PostgreSQL | The recommended production choice. Gives you backups, replication and tooling your database team already runs, at the cost of operating one more database. |
| Application database | MySQL 8.4.0 or MariaDB 10.6.0 or later | Fits organizations that standardize on MySQL-family databases. Use utf8mb4 encoding; confirm the supported versions against the current application database docs. |
| Image tag | Pinned LTS release (for example Metabase 64) | Fits production. Metabase 64 is LTS with support through 1 December 2027, so upgrades happen on a planned schedule rather than with each release. |
| Image tag | Pinned non-LTS release | Fits teams that want new features quickly and can upgrade often. Non-LTS versions usually reach end of life about 2 months after release. |
| Image tag | Floating tag such as latest | Avoid in production. An automatic pull can run migrations on the application database without a planned backup or rollback point. |
| Secret handling | Environment variables from a protected file | Fits a single host with restricted file permissions. Secrets are visible to anyone who can inspect the container environment, so restrict Docker access. |
| Secret handling | Docker secrets or an orchestrator secret store | Fits swarm or orchestrated hosts where your security team requires centralized rotation and audit. Requires that your Metabase setup reads the values from the mounted files; confirm this for your image version. |
| Configuration persistence | Settings held in the application database | Most Metabase settings are stored in the application database, so backing it up is the core recovery step. Environment variables still control database connection and must be kept in source control or a secret store. |
| Configuration persistence | Container-only state with no external database | Fits only demos. Losing the container loses the embedded H2 data, so this option carries the highest recovery risk. |
| Container count | Single container | Fits a small internal audience and simple upgrades. A single container is a single point of failure for availability. |
| Container count | Several containers sharing one PostgreSQL database | Fits higher availability needs. Confirm your Metabase version and cluster setup, since major upgrades require reducing the cluster to a single node because of a migration lock. |
Setup sequence for a production Metabase container
This sequence takes a Metabase container from an empty PostgreSQL server to a verified, documented production instance that a named team can upgrade later. Each step closes with a check, so a failed step is caught before the next one starts.
Provision a dedicated PostgreSQL application database
Create an empty PostgreSQL database and a dedicated login role that owns only that database, with a strong password generated for the role. Restrict network access so only the Metabase host or subnet can reach the database port. Confirm the server runs a PostgreSQL major version that is still in its support window on the day you deploy, using the PostgreSQL versioning policy. Check: connect with the new role from the Metabase host using psql, and confirm the role cannot read other databases on the server.
Choose and pin the Metabase image tag
Pick a Metabase release from the version support page, preferring a long-term support release for production where its end-of-life date fits your review cycle. Pin the exact tag in your compose file or deployment manifest rather than using a floating tag such as latest. Confirm the release is listed as supported on the day you deploy. Check: the tag resolves to an image digest in your registry or on the pull host, and you have recorded that digest.
Supply MB_DB_* values through a secret mechanism
Set MB_DB_TYPE to postgres, then provide MB_DB_DBNAME, MB_DB_PORT, MB_DB_USER, MB_DB_HOST and MB_DB_PASS. Inject the password and any other sensitive values from your secret manager, a Docker secret or a root-owned env file with restricted permissions, not from a plain Compose file committed to source control. Confirm the Metabase encryption secret key is also stored in that mechanism, because losing it can make encrypted settings unreadable. Check: run docker inspect on the container and confirm no plaintext password appears in the output or logs.
Start the container with an application health check
Run the container with a restart policy, a published port or reverse proxy target, and a health check that calls the Metabase application health endpoint rather than only checking that the process exists. Allow the container time to run its startup and database migrations before judging health. Confirm the health check target and timing against the Metabase documentation for your release. Check: docker ps reports the container as healthy, and the startup log shows the application database connection succeeded.
Verify the application database connection and first login
Confirm that Metabase created its application tables in the PostgreSQL database rather than falling back to the embedded H2 database, which the Docker guide does not suggest for production. Complete the initial setup in the browser, create a named administrator account, and sign in and out once to confirm sessions work. Check: query the application database for Metabase tables owned by your dedicated role, and confirm the admin login succeeds from a second browser session.
Record the image tag and environment for the runbook
Write down the exact image tag, image digest, Metabase version reported in the admin settings, the PostgreSQL version, the names of every MB_* variable (without values), and where each secret is stored. Store the record in your configuration management or runbook system with an owner. This record is the baseline for the upgrade runbook, which needs a backup of the application database before any change. Check: a colleague who did not build the instance can use the record to identify the running version and the secret source without asking you.
How the parts fit: users, the Metabase container, the application database and warehouses
The path starts with users reaching a reverse proxy that terminates TLS in the edge zone. The proxy hands requests to the Metabase container in the application zone, which reads its settings and secrets at start and keeps its own state in an external PostgreSQL application database. Metabase then sends queries across a separate boundary to the data warehouses, which hold business data and should not share credentials or network paths with the application database. Check each boundary, the secret source and which connections are allowed.
Trust boundaries between user, application, database and warehouse zones.
Security and operational considerations for Metabase containers
A Metabase container holds database credentials, an encryption key and a copy of your data source connections, so its security depends on what you keep out of the image and how you run it. The cards below cover secrets, database roles, upgrade backups, network exposure, logs and patch ownership, which together decide whether the deployment can be reviewed and maintained.
Keep secrets out of images and Compose files
The MB_DB_PASS value and the encryption key should be injected at runtime from a secrets store or an orchestrator secret, not written into a Dockerfile, an image layer or a Compose file committed to source control. Check that docker inspect output, shell history and CI logs do not reveal them, and that the files holding them have restricted permissions on the host. Rotating a password later should not require rebuilding the image.
Use a least-privilege application database role
Create a dedicated PostgreSQL role for Metabase that owns only its application database, not a superuser or a shared administrative account. Grant it the connect and schema rights needed for Metabase to run its migrations, and no access to other databases on the same server. Confirm the role settings with your DBA, and review them again after each Metabase upgrade, since migrations may need additional rights.
Back up the application database before upgrades
Metabase runs application database migrations automatically when a new image starts, and those changes are not undone by swapping the image back. Take a logical or volume-level backup of the PostgreSQL application database before changing the image tag, and record the Metabase version that produced it. Test a restore into a separate database so the rollback path is known before you need it.
Upgrade docsRestrict exposed ports
Publish only the port that the reverse proxy or load balancer needs, and bind it to a specific interface rather than all addresses. The PostgreSQL port should not be published to the host or reachable from user networks at all, only from the Metabase container network. Confirm with a port scan from outside the trusted network after each change to the Compose file or firewall.
Log and retain container output
Configure the Docker logging driver or forward container stdout to your central log platform, and set a retention period that matches your audit policy. Metabase's logs can contain query and error details, so confirm who can read them and that they are protected like other sensitive records. Test that a failed login or a database error appears in the central store before you rely on it.
Assign ownership of patching
Name one team to own the base image rebuilds and another to own Metabase release selection, because neither is updated automatically by running the container. Track the Metabase version support dates and plan upgrades ahead of end-of-life dates, and rebuild on a schedule even when Metabase itself has not changed. Write down who approves a release and who is on call for a failed migration.
Version support pageKeeping image upgrades and rollback under control
Every Metabase upgrade runs application database migrations automatically when the new container starts, so an image change is also a schema change. Treat the pre-upgrade application database backup as the first step of every upgrade, not an optional extra. The Metabase upgrading documentation recommends that backup, and it is the rollback path the docs prefer. Before you change the tag, confirm that the backup is restorable by restoring it into a scratch PostgreSQL instance and starting a throwaway Metabase container against it. Also check your upgrade path: the docs say to upgrade release by release from versions older than 40, so an instance further behind than that needs intermediate hops, each with its own backup.
For major upgrades, the docs ask you to reduce a cluster to a single node first because of the migration lock. Scale the Compose service or your orchestrator down to one Metabase container, run the upgrade, verify it, and then scale back out. Stop any scheduled jobs or automation that call the API during the window. Confirm the target version against the Metabase version support page before you choose it, because LTS releases are supported for 14 months and non-LTS releases usually reach end of life after 2 months. Choose the LTS line for production where you can, and plan the next hop before the current one expires.
Rollback has two routes. The recommended one is restoring the pre-upgrade application database backup and pointing the older image at it. The alternative is running the migrate down command with the newer JAR, which reverses schema changes in place; it depends on the migration history being intact, so test it on a copy before you rely on it. Pinned tags make either route repeatable: record the exact image tag and digest in your deployment files, never latest, so that the previous version is one edit away. Keep the old tag in your registry until the new release has run cleanly through your normal business cycle.
Questions buyers ask before running Metabase on Docker
What drives the cost of a production Docker setup for Metabase?
The main cost is the people time to design, build, test and hand over the setup, plus the infrastructure you run it on. Cost rises with the number of environments, the size of the application database you must back up, how many identity and network controls you must wire in, and how much evidence your compliance team needs. Infrastructure costs recur (compute, managed or self-run PostgreSQL, storage, backups, monitoring), while design and build are mostly one-time. Ask any partner for a written scope that lists each environment, each integration and each deliverable, because that list is what the quote should price. Licensing is separate: SSO, row and column permissions and usage auditing sit in the Pro and Enterprise plans, so check which plan your requirements need before you size the project. The Metabase pricing page lists the plan terms.
How long does a Metabase Docker production setup take?
The duration depends on scope, not on Docker itself. A single instance with a PostgreSQL application database, a reverse proxy and a documented upgrade procedure is a smaller job than a setup with SSO, multiple environments, secrets management and an audit trail. Time also depends on how quickly your team can provision the database, DNS and certificates, and how many approvals sit in your change process. No fixed duration applies to every environment, so ask for a timeline tied to the agreed scope and to the dependencies you control. DeployOpen plans most engagements as fixed scope, with scope, deliverables and timelines agreed in writing before work starts.
Can our internal team run Metabase on Docker without a partner?
Yes, if your team already runs container workloads and a PostgreSQL service, and has an owner for upgrades. The Metabase Docker guide covers the environment variables needed for a production install, including the MB_DB_TYPE and MB_DB_HOST settings that point the application at PostgreSQL. The gaps usually appear in less visible areas: keeping the encryption key and database credentials out of images, planning upgrades with a database backup first, writing health checks and restart behavior, and producing evidence for an access review. A partner is most useful when those areas must be defined, tested and documented for an assessment, or when your team lacks capacity. Compare the internal effort against a written scope before deciding.
What do we need to provide for a Docker-based Metabase install?
Plan to provide these inputs before build starts:
- A PostgreSQL application database, with a dedicated database and role for Metabase, reachable from the container network. PostgreSQL 14 is the earliest version listed as supported today, and 18 is the newest listed in the supplied facts, so confirm which version your organization standardizes on.
- Network paths: the Metabase port exposed to a reverse proxy, database connectivity, and any outbound access your policy allows.
- A secrets store or orchestrator secret mechanism for the database password and the Metabase encryption key, so they never sit in Compose files or images.
- DNS names and TLS certificates for the public URL.
- An identity provider and group design if you need SSO.
- A container host, a registry approved for images, and a monitoring target.
Is Docker the right choice compared with systemd or Kubernetes for Metabase?
Docker suits a single host or a small set of hosts where you want an image you can pin, roll back and replace. A systemd service on a Linux VM suits teams that already manage the host directly and want fewer moving parts. Kubernetes suits organizations that already run clusters, need several replicas, rolling updates and standard ingress, and have people who operate them. The choice should follow your existing platform and your operating model. Metabase runs as a JAR, so any of the three works, but the upgrade process, secret handling and health checks differ. Note that the Metabase Docker guide describes its Compose example as not meant for production, so a production Docker setup needs its own design. Compare the three options against the platform your team already supports.
What changes when we require SSO or audit logging on Docker?
SSO and usage auditing are paid features. According to the Metabase pricing page, SSO, row and column level permissions and usage analytics and auditing are included only in the Pro and Enterprise plans, not in Open Source or Starter. Open source and Starter support Google sign-in and LDAP. SAML, OIDC, JWT, advanced LDAP group sync and SCIM provisioning require Pro or Enterprise. On Docker, the container setup also changes: identity settings become configuration you must store as secrets, callback URLs must match your public hostname and TLS, and log output must be shipped to a store with retention your compliance team accepts. Confirm the plan and the identity provider setup before you finalize the design.
How do we plan upgrades for a Docker-based Metabase?
Plan upgrades around the application database, not only the image tag. Metabase runs its application database migrations automatically on upgrade, so the documented practice is to back up the application database first, and for major upgrades to reduce a cluster to a single node because of a migration lock. Rollback means restoring that backup, which is the recommended path, or running the migrate down command with the newer JAR. Metabase LTS versions receive support for 14 months, while non-LTS releases usually reach end of life after 2 months, so choose a release track deliberately. Pin image tags rather than using a floating tag, and test each upgrade in a non-production environment first.
How DeployOpen scopes and delivers a Metabase Docker deployment
DeployOpen plans and implements self-hosted open-source platforms inside your own cloud accounts, data centers or air-gapped networks. For Metabase on Docker, the work starts with a written scope covering the image, the external application database, secrets and the persistent configuration, then moves through build, testing and documented handover.
How we scope
- Confirm the Metabase edition and whether the scope needs SSO, row and column permissions, or embedding, since those features need a paid plan
- Agree the PostgreSQL application database host, version and backup approach before any container is built
- Record image tag policy, the upgrade path and who approves each Metabase release
How we build
- Configure the container with the MB_DB_* environment variables pointing at the external PostgreSQL database rather than embedded H2
- Place secrets in your secret store and inject them at runtime, keeping database credentials out of Compose files and images
- Set up health checks, restart behavior and persistent configuration, then test a container restart and a full host rebuild
How we hand over
- Deliver a runbook covering start, stop, image pinning, environment variables and where each secret is stored
- Document the application database backup routine and a restore test with the steps your operators will follow
- Walk your platform and security teams through the configuration so they can review it against your own controls
How we support
- Fixed-scope engagements are agreed in writing before work starts, with deliverables and timelines stated in the scope
- Ongoing support, upgrades and continuous testing are available as a retainer after handover
- Upgrade planning covers an application database backup before each Metabase upgrade and a rollback path if a release fails

