Running Prometheus in Docker for production: what changes outside a laptop test
A team that has Prometheus running in a container on a test host needs a different setup once that container must survive restarts, upgrades and retention periods longer than a demo. The single most important change is that the data directory, configuration and runtime flags stop living in the container's writable layer and become deliberate, persistent inputs. The official image runs the prometheus binary with a default configuration file path and a default storage path, so any setting you override with a flag or a mounted file replaces that default rather than adding to it. Prometheus is open source under Apache-2.0 and has no paid enterprise edition of the project itself, so your costs are the infrastructure that runs it, the storage it writes to, and the people who operate it.
Local storage is the part teams most often underestimate. Prometheus writes its time series database to a single node, and the storage documentation states that local storage is not clustered or replicated, so it should be managed like any other single-node database. A single container with a named volume is a reasonable shape when one team owns the monitoring, the data can be lost and rebuilt within your tolerance, and retention stays within what one disk and one host can hold. Confirm the default retention in your version (the storage documentation describes 15 days, configurable by time or size) and decide your own retention before you set flags, because retention changes disk growth directly. Also confirm that your backup approach matches the single-node model, with snapshots taken on a schedule and a tested restore.
Plan the single container as a first step, not a permanent answer. Choose it when you can accept a restart window during upgrades, when one host has enough disk for your retention, and when you can rebuild the monitoring if the volume is lost. Move toward a larger design when you need replicated storage, long-term retention beyond one host, or high availability for alerting, which is covered in the scaling and Alertmanager sections. Ask your platform owner which of these conditions hold for your environment before you commit to Compose on a single host or to a Kubernetes deployment, because that answer determines the rest of the design.
Which container options fit which production need
This table compares the container choices that matter most for a production Prometheus, with the situations where each fits and what it costs you. Read each row as a decision: pick the option that matches your storage, configuration, and operations needs, and check that any flags you add are appended to the image's default command rather than replacing it.
| Option | When it fits | Trade-off |
|---|---|---|
Named volume for /prometheus | Single-node production where Docker manages the data path and you want the TSDB separated from the container lifecycle | Data lives in Docker's storage area, so backups and host moves need deliberate tooling and a tested restore |
Bind mount for /prometheus | Teams that want the data directory at a known host path for snapshots, disk monitoring, or host-level backup jobs | Ownership and permissions must match the image user, and a wrong host path can quietly store data somewhere unplanned |
Read-only bind mount for prometheus.yml | Configuration managed in Git and deployed by a pipeline, where the container must not edit its own config | Every config change needs a reload through the lifecycle endpoint or SIGHUP, so the deployment step must include it |
Appended --storage.tsdb.retention.time or --storage.tsdb.retention.size | When disk budget or a retention requirement needs a fixed limit, set alongside the default 15 day retention | Data older than the limit is deleted, so retention must match any evidence or incident review period you have agreed |
--web.enable-lifecycle | When a CI job or an operator must trigger configuration reloads over HTTP without restarting the container | Exposes reload and shutdown endpoints, so it must sit behind authentication and a network boundary |
--web.enable-admin-api | Rarely needed in production; only for specific maintenance such as deleting series during a planned cleanup | Enables destructive operations, so keep it off by default and enable it only for a documented window |
| Memory and CPU limits | When the host is shared and Prometheus must not starve other services, sized from observed series count and query load | Too low a memory limit can cause out-of-memory restarts during heavy queries or compaction, so size from measured usage |
Setup sequence for a production Prometheus container
This sequence takes the official Prometheus image from a first test run to a container an operations team can own. Each step ends with a check, so a fault is caught before the next layer is added. The result is one single-node instance with persistent data, a read-only configuration mount, bounded resources and one reachable port.
Create a named volume for data
Create a named Docker volume, for example
prometheus-data, and mount it at/prometheus, the storage path the official image uses by default. Keeping the time series database on a named volume means it survives container replacement, which is the point of the whole sequence. Confirm the volume exists withdocker volume inspect prometheus-dataand check that its mountpoint sits on a disk with enough free space for your retention plan. The step is done when the volume is listed and the container's mounts show it at/prometheus.Mount prometheus.yml read-only
Keep the configuration file on the host, under version control if you manage it as code, and bind it into the container at
/etc/prometheus/prometheus.ymlwith the read-only flag (:ro). A read-only mount stops the process inside the container from altering its own configuration. Before the first real start, validate the file withpromtool check configfrom the same image tag, so a syntax error is found on your workstation or in CI. The step is done when promtool reports the configuration as valid anddocker inspectshows the mount as read-only.Pass retention and web flags safely
When you pass flags to the image, you replace its default arguments, so the config path and storage path must be repeated or Prometheus falls back to the wrong locations. Set
--config.file,--storage.tsdb.pathand--storage.tsdb.retention.timeexplicitly, and add--web.external-urlif the UI sits behind a proxy. Leave--web.enable-admin-apiand--web.enable-lifecycleoff unless you have a specific need for them. The step is done when the startup log shows the expected storage path and retention value, anddocker inspectshows the full command.Set restart policy and resource limits
Set the restart policy to
unless-stoppedso the container comes back after a host reboot or a crash, and set a memory limit so a runaway query or cardinality spike cannot starve the host. Size the limit from memory observed in a test run with representative targets, not from a guess, and treat it as a starting value to revisit as the series count grows. Add a CPU limit only if your platform needs one. The step is done whendocker inspectshows the restart policy and limits, anddocker statsreports the configured memory ceiling.Expose only the required port
Publish the Prometheus web port (9090 by default) only on the interface your operators and proxy use, such as
127.0.0.1:9090:9090for a host-local setup or a private network address. Do not publish ports for exporters or other internal services from this container. If a reverse proxy will serve the UI with SSO, let the proxy be the only route in. Check from another machine on the network that the port is unreachable where it should be, and reachable from the approved address. The step is done whendocker portshows the intended binding and external scans show nothing else open.Verify health and readiness endpoints
Query the health and readiness endpoints,
/-/healthyand/-/ready, from the host or from the container health check. Healthy means the process is running, and ready means it can serve queries. Add a Docker health check that calls the same endpoint so the orchestrator or your monitoring can see the state. Run the check after the container has finished starting, since the first start can take longer while it loads existing blocks. The step is done when both endpoints return success and the container reports a healthy status.Confirm every target is up
Open the Targets page in the web UI, or query
/api/v1/targetsfrom the command line, and confirm that each expected job appears with a state of up. Any target that is down needs a fix before go-live, usually a network path, a firewall rule or a wrong port in the configuration. Compare the list with the inventory you expect to monitor, because a target missing from the configuration will never appear as down and will never alert. The step is done when every target you expect is listed and up, and the list matches your inventory.Test restart and confirm data persists
Before handing the instance over, record a query for a series that has been collected for a few minutes, then stop and start the container with
docker restart. After it is ready again, run the same query over a range that spans the restart and check that the earlier samples are still present. A gap covering only the restart window is expected, while a complete loss of history means the volume or storage path is wrong. Record the test result with the date and the image tag. The step is done when earlier data is returned after the restart.
Sizing memory, CPU and disk limits without starving the server
Container limits for Prometheus are only as good as the numbers behind them. Memory, CPU and disk use follow a few drivers that interact: how many series you keep, how often you scrape, how long you retain data, and how heavy your queries are. Measure each one on your own server before you set a limit.
Active series and cardinality
The number of active series is the largest single driver of memory in Prometheus, because the head block keeps recent series in RAM. High-cardinality labels such as user IDs, request paths or container IDs multiply that count quickly. Check the active series count and the labels that produce the most series, and ask whether each label is needed before raising the memory limit.
Scrape interval and target count
Each target adds samples on every scrape, so the scrape interval and the number of targets set the ingestion rate that CPU and disk must absorb. Shorter intervals raise both write load and storage growth in proportion. Review the samples ingested per second against the interval you chose, and confirm that every scrape job needs its current frequency.
Retention size and disk headroom
Retention can be set by time or by size, and the data directory must hold the blocks, write-ahead log and any compaction work in progress. Plan disk in terms of your ingestion rate multiplied by retention, then keep free space above the level that compaction needs. Set a size limit as a safety net so the volume does not fill, and confirm the behavior of your chosen flags in the storage documentation.
Prometheus storage docsQuery load and expensive PromQL
Dashboards and alert rules run queries against the same server that ingests data, and wide range queries over many series use large amounts of memory and CPU. Refresh rates on dashboards and the number of users who open them both affect load. Log slow queries, review rule evaluation time, and set query limits so one heavy dashboard cannot starve ingestion.
Out-of-memory kills during compaction
Compaction and heavy queries can briefly need more memory than steady state, and a container that exceeds its memory limit is killed by the runtime. The restart then replays the write-ahead log, which takes time and can delay alerting. Leave headroom above typical use, watch peak memory under load, and treat repeated restarts as a sizing problem to fix before tuning anything else.
Measure before setting limits
Limits chosen from guesses either waste capacity or fail under load. Run the server with no hard limit for a representative period, record peak memory, CPU, ingestion rate and disk growth, then set limits with headroom above those peaks. Ask your team to repeat the measurement after each major change in scrape configuration, rules or retention, and before any upgrade.
Upgrading the Prometheus container without losing data or alerts
Prometheus ships a new minor release every 6 weeks, and a minor release generally stops receiving bug fixes after those 6 weeks. Running a minor version for months therefore means running unpatched code. Most production teams should instead track the long-term support (LTS) line, which receives bug fixes for one year. The current LTS line is 3.13, released July 1, 2026 and supported until July 31, 2027, and LTS 3.5 reached end of life on July 31, 2026. Read the release cycle page to confirm dates before you choose a line. The latest releases as of October 2026 are v3.15.0 and the LTS patch v3.13.4, but confirm the current tag on the GitHub releases page before you pin anything.
Pin the image to an exact tag such as prom/prometheus:v3.13.4 in your Compose file or manifest, never latest, so a restart cannot change the version silently. Before moving to a new tag, read its release notes for removed or changed flags, storage behavior and configuration fields. Then run promtool check config and promtool check rules against your current prometheus.yml and rule files using the new image, so syntax and deprecations surface before production. Next, stop the container, copy the named data volume to a backup location, and start the new image against a copy of that data in a staging stack. Confirm that targets are up, rules load and a test alert reaches Alertmanager.
Plan rollback before the upgrade. Keep the old image tag, the backup of the data volume and the previous configuration in version control, so you can revert the tag and restore the copy within the same maintenance window. Downgrading a Prometheus server over a newer time series database is not something to assume will work, so treat the volume backup as the rollback path. Record the deployed tag and the time of each change so you can match alert gaps to a specific upgrade. Ask your implementation partner or internal team to write down who approves the upgrade, who watches the first hours of alerting and what triggers a rollback.
When Docker Compose is enough and when Kubernetes is the better fit
Docker Compose is usually enough when one Prometheus server, a small number of Alertmanager instances and a set of exporters fit on one host, and when a small team can own that host end to end. Compose gives you a readable file that defines the containers, volumes, networks and restart policy, and it can be kept in Git next to the configuration. The trade-off is that the host is the failure domain: if it goes down, scraping and alerting stop until it returns.
- Ownership: one team owns the host, the Compose file, the image pins and the backups of the data volume.
- Restart behavior: a restart policy brings containers back after a crash or reboot, but nothing moves them to another machine.
- Storage: data lives on a named volume on that host. Local storage is not clustered or replicated, so the volume must be backed up and managed like any single-node database.
- Upgrades: you pull a pinned image tag, test it, and recreate the container. Rollback means restoring the previous tag and, when needed, the volume.
- Alertmanager: running a few instances in Compose is possible, but cluster behavior still needs to be configured and tested.
Before committing to this model, confirm the host sizing and the disk growth for your retention period in your own environment.
Kubernetes is the better fit when your organization already runs clusters, has staff who operate them, and wants monitoring deployed with the same tooling, policies and release process as the workloads it watches. Scheduling, health checks, rolling updates and persistent volume claims are then available without building them yourself. The cost is complexity: you take on cluster-level permissions, storage classes and the operational knowledge needed to troubleshoot them.
- Ownership: the platform team owns the cluster, while the monitoring team owns the Prometheus configuration and rules, which should be agreed in writing.
- Restart behavior: the scheduler reschedules failed pods, but a pod with a single volume still restarts on the node where that volume is attached.
- Storage: persistent volumes depend on the storage class in your cluster. Confirm its performance and snapshot support with your storage provider.
- Upgrades: rollouts follow your cluster's upgrade cadence, so Prometheus versions must be checked against cluster versions and the release cycle.
- Configuration: scrape configuration is commonly generated from cluster objects, which changes how reviews and rollbacks are handled.
Before choosing this model, ask who on your team will be on call for the cluster and whether that team already has the skills to debug it.
Needs for high availability or long-term retention do not go away by moving Prometheus to a bigger host or a larger cluster. Prometheus local storage is not clustered or replicated, and it has a default retention of 15 days, configurable by time or size. When the requirement is to keep data longer, or to keep alerting and querying working through a single failure, the design must add a separate component rather than rely on one server's disk. Remote write and remote read let Prometheus send samples to and read from external long-term storage systems.
- High availability: running two Prometheus servers that scrape the same targets is a common pattern, but query and deduplication behavior must be designed and tested.
- Alertmanager: Prometheus should point at every Alertmanager instance rather than at a load balancer, and the cluster flags must be set so instances share state.
- Long-term storage: a remote store has its own sizing, backup, access control and upgrade needs, and it is a separate system to operate.
- Cost: the remote store adds infrastructure and staff time that recur alongside the Prometheus server.
- Upgrades: each component is upgraded in an order that keeps remote write compatible.
Before committing, confirm the retention, recovery time and query requirements with the people who will rely on them.
Securing the container: TLS, authentication, admin APIs and exposed ports
Prometheus ships with few security controls switched on, so the container's exposed port, its web endpoints and its scrape configuration all need deliberate settings. The cards below cover what Prometheus provides, what it leaves to a reverse proxy, and what to check before the container faces any network beyond the host. For task-level steps, see the Prometheus security hardening page.
TLS and client certificates
Prometheus can serve its web UI and API over TLS and can require client certificates, with TLS 1.2 as the minimum version. Mount the certificate and key files into the container as read-only files, reference them in the web configuration file, and confirm that plain HTTP is not also listening on the published port. Plan certificate renewal before expiry, since a container restart is needed to load new files in many setups. Confirm the exact configuration keys against the version you deploy.
Security modelBasic auth only over TLS
Prometheus supports HTTP basic authentication with bcrypt-hashed passwords, but the credentials travel in cleartext unless TLS is in place. Never enable basic auth on a container reachable on a plain HTTP port. Generate the bcrypt hashes outside the image, store them in a mounted file rather than in the image or a Compose file committed to Git, and rotate them through your normal secrets process.
Admin and lifecycle endpoints
The admin HTTP APIs are disabled by default. The --web.enable-admin-api flag enables destructive operations such as deleting series, and --web.enable-lifecycle enables reload and shutdown endpoints. Only enable them when a specific workflow needs them, such as configuration reloads from CI. Review the container command for these flags during every deployment, because a Compose override can add them without anyone noticing.
Reverse proxy for SSO and CSRF
Prometheus has no built-in single sign-on, and its security model notes it has no built-in CSRF protection on endpoints that change state. The usual pattern is an authenticating reverse proxy in front of the UI and API, with the container bound to an internal network only. Decide where the proxy runs, which identity provider it trusts, and which paths it exposes. Test that the proxy blocks direct access to the container port from other networks.
Exporter abuse through URL parameters
Exporters such as SNMP and Blackbox take their targets from URL parameters. Anyone with HTTP access to these exporters can make them send requests to arbitrary endpoints, which can reach internal services the exporter's host can see. Run exporters on a private network, restrict which clients can call them, and limit the targets they are allowed to probe. Review each exporter's container in the same pass as Prometheus itself.
Ports published from the container
Publishing the container port with -p or a Compose ports entry exposes it on the host interface, which is often broader than intended. Bind the published port to a specific internal address, or publish only to the reverse proxy network. Scan the host from another network segment after each change to confirm that only the intended ports answer, and document which ports belong to Prometheus, Alertmanager and each exporter.
How the container, volumes, config and Alertmanager connect
The diagram starts at the host, where the Prometheus container runs with a named data volume for the TSDB and a read-only config mount for prometheus.yml and rules. Prometheus pulls metrics from scrape targets over HTTP and sends firing alerts to every Alertmanager instance, not to a load balancer. The reverse proxy and its authentication sit in front of the web UI and API, inside a trust boundary. Check that the admin and lifecycle endpoints are not reachable past that boundary, and that the data volume is backed up like any single-node database.
Container, volumes, config mount, scrape targets, Alertmanager and the proxy trust boundary.
Limits to confirm in your own environment before go-live
A Docker deployment of Prometheus depends on a few values that the image does not decide for you: how much disk retention needs, how the runtime reacts to restarts and memory pressure, and whether your registry and backups meet your recovery goals. Confirm each item with the vendor docs and with your own tests before you accept traffic.
Retention size against disk
Prometheus keeps local data for a default retention of 15 days, and you can limit it by time or by size. Size the data volume for your sample rate and series count, then set the size limit below the volume capacity so the database does not fill the disk. Check the storage docs for how size-based retention interacts with the two-hour blocks and the write-ahead log, and test a full-retention disk alert before go-live.
Storage docsContainer restart and memory behavior
Confirm how your container runtime restarts Prometheus after a crash and how it handles out-of-memory kills, including restart policy, memory limits and whether the process gets a clean shutdown signal. Run a controlled kill and a memory-pressure test on a staging host, then check that the data directory recovers and that scrape gaps are visible in your dashboards.
Image mirroring for restricted registries
If your network blocks public registries, mirror the official Prometheus image and any sidecar or exporter images into your internal registry. Pin the tag or digest you tested, and confirm that your mirror process copies new patch releases on the schedule your change process allows. Ask your security team whether the mirror needs signature or scan checks before images are pulled.
Flags supported by your version
Command-line flags change between major and minor releases, and a flag removed in one version will stop the container from starting. Check every flag in your command or args block against the release notes for the exact version you run. Use a staging container with the same image tag to confirm that the process starts, loads the configuration and passes its health check.
Backup and recovery expectations
A named volume holds the local time series database, so a volume backup is the only local copy of recent history. Decide how much data loss you accept, then test a restore into a clean container and confirm that queries return the expected range. Prometheus local storage is not replicated, so treat the volume like a single-node database and ask whether your backup tool captures it while Prometheus is running.
Storage docsQuestions teams ask before running Prometheus in Docker in production
What does it cost to run Prometheus in Docker in production?
Prometheus itself is free. It is licensed under Apache-2.0 with no paid enterprise edition, so the cost comes from four places: the hosts and storage that run it, the implementation work, the operator time to keep it running, and any external long-term storage or support you add. Infrastructure cost rises with the number of active series, scrape frequency and retention. Storage is the item most teams underestimate, because local storage holds data on one node and the default retention is 15 days, which you may change by time or size. Ask any partner for a quote that lists implementation, storage sizing, backup, upgrade and recurring operator time as separate lines.
How long does a production Prometheus setup take?
The duration depends on how many targets you scrape, how many alert rules and receivers you need, whether you run Alertmanager in a cluster, and how many environments must match. A single Prometheus container with a few static targets and one notification channel is a much smaller job than a multi-environment rollout with service discovery, TLS, SSO in front of the UI and tested alerts. Your scope and timeline are agreed in writing before work starts, so ask for the list of targets, receivers and access requirements up front, since those inputs change the schedule most.
What must our team provide before the work starts?
Plan to provide the following before implementation begins:
- One or more Linux hosts or VMs with Docker or a compatible container runtime, and capacity for storage and retention you choose
- DNS names for Prometheus and Alertmanager, plus the internal networks they must reach
- TLS certificates and the private CA or chain your clients trust, if you use TLS
- A complete target list, including job names, ports, metrics paths and which team owns each target
- Notification endpoints for Alertmanager, such as email relays or chat webhooks, and the people who receive pages
- An identity provider if the web UI must sit behind SSO
Missing target ownership and notification details cause most delays.
Can our internal team run Prometheus in Docker alone?
Often yes, if you have one or two engineers who already run containers and understand monitoring. The container setup is simple. The harder parts are sizing storage, writing and testing alert rules, securing the endpoints, and keeping configuration under change control. Prometheus is a single-node database, so you need a plan for backups and recovery, and someone must watch the server itself, not just the services it watches. Decide who owns each area before you start. If nobody has time for that ongoing work, a partner can build the system and hand it over with documentation.
When should we hire outside help for Prometheus?
Consider outside help when the deployment has to pass a formal review, when targets sit behind firewalls or in several networks, when you need TLS and authentication across the UI, API and Alertmanager, or when the team lacks time to handle upgrades. Outside help also makes sense when you need a clear handover, written runbooks and tested alert rules. You can keep the core work in house and buy specific pieces, such as a security review or a reverse proxy design, instead of the whole build. Ask any partner to show how the work is split between your staff and theirs.
Where does the security and compliance work fit?
Security work is part of the build, not an add-on. Prometheus supports TLS with client certificates and HTTP basic authentication, but basic authentication without TLS exposes credentials in cleartext. It has no built-in single sign-on, so SSO normally comes from an authenticating reverse proxy. Admin APIs are disabled by default, and the lifecycle endpoints are off unless you enable them. Prometheus can produce monitoring and capacity evidence for an assessment, but it does not issue audit reports. Independent auditors and certification bodies do that work, and you should confirm what evidence they need before the design is fixed.
How are upgrades and support handled?
Prometheus minor releases start a new cycle every 6 weeks, and a minor release generally stops receiving bug fixes after those 6 weeks. Long-term support releases receive bug fixes for one year. The current LTS line is 3.13, supported until July 31, 2027, according to the project's release cycle page, so many teams pin to an LTS line and plan upgrades on a fixed schedule. Test each upgrade against a copy of your configuration and rules, and check promtool validation before rollout. Prometheus has no paid enterprise edition, so support comes from your own team, a community or a partner. DeployOpen offers ongoing support, upgrades and continuous testing as retainers, and the terms are set in writing.
How DeployOpen scopes and delivers a production Prometheus container
DeployOpen deploys Prometheus inside your own infrastructure, whether that is your cloud accounts, your data center or an isolated network, and starts only after the scope is agreed in writing. The written scope names the hosts or container platform, the image and version to pin, the named volume and retention settings, the configuration mounts, the scrape targets and alert rules in the first release, and the people who will receive handover. Most engagements are fixed-scope, so the deliverables and timeline are fixed before the first container starts. A quote follows from that written scope. Ask for the scope document to list each item explicitly so you can compare proposals on equal terms.
The delivery covers the Docker runtime and the Prometheus configuration as well as the controls around them. DeployOpen sets the admin API and lifecycle flags deliberately, puts TLS and authentication in front of the web UI and API, and places any single sign-on behind an authenticating reverse proxy because Prometheus has no built-in SSO. Backups of the named volume are designed and tested with a restore rehearsal, and the upgrade procedure is written against the release cycle your organization chooses. Documentation covers the container definition, the configuration repository, the runbook for restarts and reloads, and the evidence an internal auditor is likely to request. Confirm with the provider which of these items are included in the fixed scope and which are optional add-ons.
After handover, ongoing support, upgrades and continuous testing are available as a retainer, which suits teams that want an outside party to track the Prometheus release line and apply patches on a planned schedule. Your own team carries the cost of the platform hosts, storage and the staff who receive the runbook, and those costs recur whether or not a partner is involved. Before signing, ask the provider to confirm who holds administrator credentials after handover, how secrets are stored, what the retainer covers, and how an emergency patch is handled outside the planned window. Those answers determine whether the deployment remains under your control once the engagement ends.

