Getting Started
Verified against
v1.21.1. Commands assume Docker (v20.10+) and Docker Compose (v2.30+).
Prerequisites
- Docker and Docker Compose installed.
- About 4 GB RAM and 10 GB disk free.
- Linux, macOS, or Windows with WSL2.
Install
Cortex ships as a binary and as a container image at quay.io/cortexproject/cortex. The fastest path to a working setup is the Docker Compose bundle in the repository, which runs Cortex in single-binary mode together with Prometheus, Grafana, and SeaweedFS (S3-compatible storage).
git clone https://github.com/cortexproject/cortex.git
cd cortex/docs/getting-startedA first working setup
This brings up Cortex (-target=all), Prometheus remote-writing into it, S3-compatible storage, and Grafana for queries.
Start the bundled stack.
bashdocker compose up -dCompose pulls images, starts SeaweedFS, initializes S3 buckets, then starts Cortex, Prometheus, and Grafana. Prometheus scrapes itself and remote-writes the samples to Cortex at
/api/v1/push.To run Cortex directly instead of via the bundle, use single-binary mode with a config file (a local blocks-storage example ships at
docs/configuration/single-process-config-blocks-local.yaml).bashcortex -target=all -config.file=./single-process-config-blocks-local.yaml
Verify it works
- Cortex serves a readiness endpoint at
/ready; a healthy instance returns HTTP 200.
curl -s http://localhost:9009/ready- In Grafana, add Cortex as a Prometheus data source and query a metric such as
upto confirm samples are stored and queryable. - Multi-tenant requests require the
X-Scope-OrgIDheader, because auth is enabled by default (pkg/cortex/cortex.go:151). Local URLs such ashttp://localhost:9009are placeholders for your own deployment.
Where to go next
- The repository's
docs/getting-started/single-binary.mdwalks through the full Compose tutorial, including recording rules and Alertmanager. - For production concerns (HA, security hardening, scaling each module independently), see the configuration docs under
docs/configuration/and the microservices guide indocs/getting-started/microservices.md.