

Install Prometheus & Grafana with Docker
This guide shows how to set up server monitoring with Prometheus, Grafana and Node Exporter via Docker Compose. Prometheus collects CPU, RAM, disk and network metrics, and Grafana displays them in dashboards.
Step 1: Create the Directory Structure and Configuration
Create a directory for your monitoring stack with subdirectories for the Prometheus configuration and the data. The data directories are assigned to the users the containers run as (Prometheus: UID 65534, Grafana: UID 472):
Now create the Prometheus configuration file:
Paste the following base configuration. It instructs Prometheus to monitor itself and the Node Exporter, which we will set up in the next step:
Step 2: Create the Docker Compose File
In the root of your monitoring-stack directory, create the Compose file:
Paste the following content. The file defines three services: Prometheus for metric collection, Grafana for visualization, and Node Exporter which exposes your server's metrics:
Step 3: Start the Monitoring Stack
Start all three containers with a single command:
Docker will pull the images and start Prometheus, Grafana, and Node Exporter in the background.
Step 4: Connect Grafana to Prometheus
Open your browser and navigate to http://YOUR_SERVER_IP:3000. Log in with the default credentials — username admin, password admin. You will be prompted to set a new password immediately.
http://prometheus:9090 as the Prometheus server URLStep 5: Import a Dashboard
Import a pre-built dashboard to start visualizing your server metrics right away:
1860 — a widely used dashboard for server monitoringFurther Documentation
For advanced configurations, custom dashboards, and alerting setup, refer to the official documentation for each tool.