Skip to main content

Prometheus

Prometheus is an open-source systems monitoring and alerting toolkit, designed for reliability and scalability. It records real-time metrics in a time series database built using a HTTP pull model.

Architecture

This container provides a production-ready Prometheus setup with:

  • Prometheus 3.8.x latest stable release
  • Environment-driven configuration for all features
  • Native histogram support for fine-grained metrics
  • Exemplar storage for trace integration
  • Memory snapshot on shutdown for data persistence
  • Config auto-reload capability

Prerequisites

Prometheus requires a configuration file mounted at /etc/prometheus/prometheus.yml. Without this file, the container will exit with an error.

Quick Start

services:
prometheus:
image: ghcr.io/supanadit/containers/prometheus:3.8.1-r2
container_name: prometheus
environment:
PROMETHEUS_PORT: 9090
ports:
- "9090:9090"
volumes:
- prometheus_data:/opt/prometheus/data
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost:9090/-/healthy || exit 1"]
interval: 10s
timeout: 5s
retries: 5

volumes:
prometheus_data:

Configuration

Create a basic prometheus.yml configuration file:

global:
scrape_interval: 15s
evaluation_interval: 15s

scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]

- job_name: "my-app"
static_configs:
- targets: ["my-app:9100"]
labels:
app: "my-application"

Deployment Scenarios

ScenarioUse CaseDocumentation
Basic SetupSingle node monitoringConfiguration and env vars
With ThanosLong-term storageThanos sidecar integration
FeaturesAdvanced featuresNative histograms, exemplars, etc.

Verifying Prometheus

# Check Prometheus is healthy
curl http://localhost:9090/-/healthy

# Check Prometheus targets
curl http://localhost:9090/api/v1/targets

# Check Prometheus metrics
curl http://localhost:9090/metrics

Next Steps