Nothing appears in Grafana until a data source is connected correctly, and the URL is the most common mistake.
Grafana runs as a single server process, from OS packages, a binary or the official Docker image grafana/grafana. It listens on port 3000; the first login is admin / admin, and you're asked to change the password immediately. Configuration lives in grafana.ini (or custom.ini), and any setting can be overridden by environment variables named GF_<SECTION>_<KEY>, such as GF_SECURITY_ADMIN_PASSWORD. Data such as the SQLite database and plugins live in /var/lib/grafana; mount a volume there.
Add a data source under Connections, Data sources, Add new data source, Prometheus:
- URL: the address as seen from the Grafana server, not from your browser. In Docker Compose that is the service name, such as
http://prometheus:9090;localhostthere means the Grafana container itself. - Scrape interval: set it to your Prometheus scrape interval (e.g. 15s). Grafana uses it to compute safe
rate()ranges. - Authentication if Prometheus is behind a proxy.
Save & test runs a test query. Queries are sent by the Grafana backend (server-side), so Prometheus doesn't need to be reachable from users' browsers.
Example
# docker-compose.yml
services:
prometheus:
image: prom/prometheus:v3.13.4
ports: ["9090:9090"]
grafana:
image: grafana/grafana:13.2.0
ports: ["3000:3000"]
environment:
GF_SECURITY_ADMIN_PASSWORD: change-me # instead of admin/admin
volumes:
- grafana-data:/var/lib/grafana
volumes:
grafana-data: {}
# In Grafana: Connections > Data sources > Prometheus
# URL: http://prometheus:9090 (service name, not localhost)
# Scrape interval: 15s
# Save & test -> "Successfully queried the Prometheus API." Remember
- Grafana listens on :3000; settings via grafana.ini or GF_ environment variables
- Data source URLs are resolved from the Grafana server
- Set the data source scrape interval to match Prometheus
Watch out for
- Using http://localhost:9090 when Grafana runs in a container; it points at the Grafana container.