Skip to main content

Monitor Docker Services Using Grafana, Prometheus & cAdvisor — Without Touching the CLI

 

If you're running Docker containers on a server, monitoring their performance using command-line tools can be time-consuming and difficult to visualize. In this guide, I’ll show you how to monitor your Docker services using Grafana, Prometheus, and cAdvisor—all through a web interface, without relying on CLI tools after setup.

You’ll be able to:

  • Track real-time Docker container metrics
  • Visualize system performance through a Grafana dashboard
  • Use Prometheus to scrape and expose container metrics
  • Deploy everything using simple Docker commands

Step 1: Run Your Docker Containers

Make sure your Docker containers are already running. Here’s a snapshot of my currently active containers:


Step 2: Install cAdvisor in a Docker Container

To collect container metrics in real time, we’ll run cAdvisor inside a dedicated Docker container.

Run the cAdvisor Container:

sudo docker run

  --volume=/:/rootfs:ro

  --volume=/var/run:/var/run:rw

  --volume=/sys:/sys:ro

  --volume=/var/lib/docker/:/var/lib/docker:ro

  --publish=8080:8080

  --detach=true

  --name=cadvisor

  --privileged

  --device=/dev/kmsg

  gcr.io/cadvisor/cadvisor:v0.49.1


Test cAdvisor:
Open your browser and go to: http://localhost:8080/metrics
You should see live Prometheus-formatted metrics for all running containers.

Step 3: Set Up Prometheus for Metrics Collection

Next, we’ll install Prometheus to collect metrics from cAdvisor and serve them to Grafana.

Create prometheus.yml:
scrape_configs:
  - job_name: 'cadvisor'
    static_configs:
      - targets: ['localhost:8080']

Run Prometheus Container:
docker run -d
  --name=prometheus
  -p 9090:9090
  -v /home/prometheus.yml:/etc/prometheus/prometheus.yml
  prom/prometheus

Open Prometheus in your browser: http://localhost:9090/metrics

You should see structured metrics being collected as following output:

Step 4: Deploy Grafana for Visualization

Now install Grafana as a Docker container:
docker run -d -p 3000:3000 --name=grafana --restart always
-v grafana-storage:/var/lib/grafana grafana/grafana

Access Grafana at: http://localhost:3000
Login with the default credentials or set up a new admin account on first login.

Step 5: Connect Prometheus to Grafana

Add Data Source:
  1. Go to http://localhost:3000
  2. Login → Click the ⚙️ (Settings/Gear icon) → Data Sources
  3. Click Add data source
  4. Choose Prometheus
    •     Set URL to: http://host.docker.internal:9090 (Windows/macOS)
    •     or http://x.x.x.x:9090 (for external access)
  5. Click Save & Test

Step 6: Import Docker Monitoring Dashboard

Option A: Import via Dashboard ID
  1. In Grafana, click ➕ → Import
  2. Enter Dashboard ID: 14282
  3. Click Load
  4. Choose your Prometheus data source
  5. Click Import
  6. Save the dashboard with your preferred name

Option B: Import via JSON (If Dashboard ID fails)
  1. Visit: 1.      https://grafana.com/grafana/dashboards/14282
  2. Click “View JSON”
  3. Right-click → Save As → Save it as docker-dashboard.json
  4. Go back to Grafana → ➕ Import → Upload JSON file
  5. Select Prometheus as the data source → Click Import

Final Result: Real-Time Docker Monitoring Dashboard

Once everything is configured, you'll see a powerful Grafana dashboard displaying:
  • CPU & memory usage per container
  • Disk I/O, network throughput
  • Container uptime & health
  • System-wide Docker stats
This dashboard eliminates the need to monitor your containers using CLI commands and provides a clear, visual overview that is ideal for debugging, reporting, and ongoing performance tuning.


Using Grafana, Prometheus, and cAdvisor, you can effortlessly monitor Docker containers in real time—without any command-line stress. This can be use not just container metrics, but also the host machine performance, network throughput, and resource usage trends. This setup is perfect for NOC engineers, Datacenter engineers, developers, DevOps engineers, or system administrators who prefer a visual interface for performance tracking.

Comments

Most Popular Topics

Unboxing & Configuring Heltec ESP32 V3 LoRa Boards – Easy Peer-to-Peer Communication Setup

  LoRa (Long Range) is a wireless communication technology designed for long-distance, unlicensed frequency, low-power data transmission. It’s widely used in IoT (Internet of Things) applications where devices need to send small amounts of data over several kilometers without relying on Wi-Fi or cellular networks. With its low power consumption and extended range, LoRa is ideal for smart agriculture, environmental monitoring, and remote sensing projects. In this guide, I’ll walk you through my LoRa implementation setup using the Heltec ESP32 V3 boards. If you haven’t already installed the Arduino IDE on your computer, make sure to install it first. it’s essential for uploading code to your LoRa boards. Once the Arduino IDE is successfully installed, it should look like the screenshot below (or similar depending on your version). From there, follow the steps outlined in this tutorial to configure your boards for peer-to-peer communication. For this project, I used two Heltec ESP32 V...

ESP32 with Neo-6M GPS Module: Hardware Serial Code & Practical Implementation Guide

In this project, I used the ESP32 WROOM-32 development board in combination with the Neo-6M GPS module to acquire real-time satellite-based location data. The hardware components were interconnected using hardware serial (UART) to ensure reliable communication between the ESP32 and the GPS module. The wiring setup is illustrated below. Neo-6M GPS Module     |      ESP32 WROOM-32        Vcc      =====>   VIN (3.3V) GND   =====>     GND     TX      =====>    GPIO16     RX     =====>   GPIO17 Snapshot of the NEO-6M GPS Module used in this project: Front View of the NEO-6M GPS Module Backside of the NEO-6M GPS Module Snapshot of the ESP32 WROOM-32 Arduino board used in this project: After the interconnecting these two boards you have to follow following procedures. Install TinyGPS++ library: Open Ardui...

How to Create a New Virtual Machine on VMware Workstation Player | How to Install CentOS 8 Linux

This comprehensive video course series is dedicated to imparting essential skills in Linux server handling and web hosting. The primary goal is to offer a user-friendly and practical learning experience. The content delves into the intricacies of creating a virtual machine using VMware, providing step-by-step guidance on the installation process for CentOS 8. A significant aspect covered in this series is the exploration of package installations, including the crucial step of checking repositories. Through a blend of theoretical explanations and hands-on examples, viewers gain a solid foundation in server administration. The structured instructions ensure a seamless learning journey, enabling individuals to effortlessly follow and implement the demonstrated procedures.

Different dates data plot on common x axis in 24-hour time frame using python.

Here, I used a different method to represent hourly data across various dates. I converted specific dates to common dates and then plotted the time series data on a 24-hour time frame along the x-axis, with traffic patterns on the y-axis.  import os import pandas as pd import numpy as np import matplotlib.pyplot as plt from datetime import datetime import matplotlib.dates import matplotlib.dates as md path = 'datasheet.csv' data = pd.read_csv(path) data.head() # Convert data to DataFrame df = pd.DataFrame({'Date&Time': data['Date'] , 'DL': data['DL']/1000000000, 'UL': data['UL']/1000000000}) # Replace all Date&Time with '02/02/2024' df['Date&Time'] = '02/02/2024 ' + df['Date&Time'].str.split(' ', expand=True)[1] # Convert 'Date&Time' column to datetime format df['Formated_Date'] = pd.to_datetime(df['Date&Time'], format='%m/%d/%Y %H:%M...

Scientific Writing - Research Article

  Significant sections of the Research Article How to write an Abstract? The abstract section is very important for the scientific paper because it represents all the contents briefly of a paper and the reader will decide whether or not to read the whole article. This is written by summarizing the introduction section. It has to briefly include the  problem, method, findings, and conclusion usually in the factual or past tense. How to write an Introduction? Start with a broad overview of the research scope. You have to provide a general background of the field or topic. Then you write a  literature survey about the topic. It does a critical analysis of the existing research on a specific topic. The next step is explaining a problem statement or research gaps . Then you can be writing  research objectives to provide the solution to the given problem statement or research gaps. Finally write scope and limitations that explain how the limitations may have affec...

Partitioning hard drives in Linux servers

ADDING PARTITIONS, FILE SYSTEMS, AND PERSISTENT MOUNTS The following flow chart indicates adding partitioning, file systems, and creating mount points for partitioning on Linux systems in a very short format and this is able to understand easily the complex process of Linux storage management. LOGICAL VOLUME MANAGEMENT (LVM) CONCEPTS The following flow chart indicates the LVM concepts very shortly on Linux systems.

What is a Network Operation Center (NOC)? Key Functions, Roles, and Benefits

A Network Operation Center (NOC) is a centralized facility where IT professionals monitor, manage, and maintain network systems around the clock. Acting as the command center for network performance and security, a NOC ensures seamless communication, stability, and efficiency across an organization’s infrastructure. NOCs are responsible for a range of critical tasks, including: Monitoring network devices and data flows Maintaining system health and software updates Troubleshooting and identifying network anomalies Rectification of errors and service disruptions Escalating issues to higher-level support teams Supervising and organizing system operations A NOC can be either internally managed by the organization or outsourced to a managed service provider (MSP). The choice depends on factors such as company size, network complexity, and operational budget. NOC Performances Metrics and KPIs Who Needs a NOC? Organizations with large-scale or mission-critical networks—such as telecom pr...

Innovative AI Frameworks for Controlling Plant Growth Parameters

Food is a fundamental necessity for human survival, leading to the expansion of crop cultivation beyond traditional rural areas into urban environments. Urban farming presents several advantages, including access to fresh, organic produce and the creation of new job opportunities. However, despite these benefits, urban agriculture faces notable challenges. Organic foods are often more expensive, and the success of urban farming initiatives can be hampered by insufficient space for plant growth, insufficient knowledge, inadequate conditions for plant growth, and significant environmental changes driven by global development. To address these challenges, this research focuses on leveraging Artificial Intelligence (AI) techniques to enhance urban farming practices. By applying AI, it is possible to optimize growing conditions, predict and manage plant needs, and adapt to changing environmental factors. AI can also help streamline operations and reduce costs, making urban farming more viab...

How to Create a Share Folder Between Virtual Machine and Host Computer

  In this episode, I’m going to guide you through the process of creating a shared folder between your host computer and a virtual machine (VM). This is a common challenge, as many people struggle with sharing files seamlessly between their host system and a VM. To address this issue, I’ll be demonstrating how to set up a shared folder using VMware Workstation Player, which will allow you to access files from both the host computer and the virtual machine. Having a shared folder is particularly useful for Linux beginners who are working on their lessons or projects within a virtual environment. By creating this shared folder, you’ll have a convenient way to transfer files, collaborate across different systems, and keep your work organized. This setup not only simplifies the process of file sharing but also enhances your workflow, as you won’t need to rely on external drives or other complicated methods to move files between the host and the VM. Moreover, we’ll be using this shared ...