{"id":564,"date":"2026-07-24T16:57:39","date_gmt":"2026-07-24T16:57:39","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=564"},"modified":"2026-07-24T16:57:39","modified_gmt":"2026-07-24T16:57:39","slug":"container-monitoring-vps-docker-cadvisor-prometheus","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/","title":{"rendered":"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus"},"content":{"rendered":"<p class=\"wp-block-paragraph\">When running containerized workloads on a VPS, monitoring resource utilization across containers becomes critical. Unlike traditional server monitoring, container monitoring must account for ephemeral instances, shared kernel resources, and dynamic scaling. This guide walks through three complementary monitoring approaches \u2014 from the lightweight <code>docker stats<\/code> CLI to a full Prometheus and cAdvisor stack. If you are evaluating VPS plans to run containers, start with <a href=\"https:\/\/virtualserversvps.com\/#providers\">our VPS comparison table<\/a> to find a provider with sufficient CPU and RAM for your workloads.<\/p><h2 class=\"wp-block-heading\">What Youll Need<\/h2><ul class=\"wp-block-list\"><li>A VPS running Ubuntu 22.04 or Debian 12 (minimum 2 GB RAM, 2 vCPUs)<\/li><li>Docker Engine installed and configured<\/li><li>SSH access with sudo privileges<\/li><li>Ports 8080 (cAdvisor) and 9090 (Prometheus) available in your firewall<\/li><li>Basic familiarity with the Linux command line and YAML configuration<\/li><\/ul><h2 class=\"wp-block-heading\">Step 1: Quick Monitoring with Docker Stats<\/h2><p class=\"wp-block-paragraph\">The quickest way to see container resource usage is the built-in <code>docker stats<\/code> command. It shows live CPU, memory, network I\/O, and block I\/O for all running containers in a table format.<\/p><pre class=\"wp-block-code\"><code>docker stats --all --no-stream<\/code><\/pre><p class=\"wp-block-paragraph\">Remove <code>--no-stream<\/code> to get a live-updating view. While useful for ad-hoc debugging, <code>docker stats<\/code> does not persist data. For historical retention and alerting, you need a dedicated monitoring stack.<\/p><h2 class=\"wp-block-heading\">Step 2: Deploy cAdvisor for Container Metrics<\/h2><p class=\"wp-block-paragraph\"><strong>cAdvisor<\/strong> (Container Advisor) is an open-source agent from Google that collects, aggregates, and exports resource usage and performance data for running containers. It exposes a web UI on port 8080 and emits Prometheus-compatible metrics.<\/p><p class=\"wp-block-paragraph\">Deploy cAdvisor as a Docker container:<\/p><pre class=\"wp-block-code\"><code>docker run -d \\\n  --name=cadvisor \\\n  --restart=unless-stopped \\\n  -p 8080:8080 \\\n  -v \/:\/rootfs:ro \\\n  -v \/var\/run:\/var\/run:ro \\\n  -v \/sys:\/sys:ro \\\n  -v \/var\/lib\/docker\/:\/var\/lib\/docker:ro \\\n  -v \/dev\/disk\/:\/dev\/disk:ro \\\n  --privileged \\\n  --device=\/dev\/kmsg \\\n  gcr.io\/cadvisor\/cadvisor:latest<\/code><\/pre><p class=\"wp-block-paragraph\">Verify it is running by visiting <code>http:\/\/&lt;your-vps-ip&gt;:8080<\/code>. The dashboard shows per-container CPU, memory, network, and filesystem metrics in real time.<\/p><h2 class=\"wp-block-heading\">Step 3: Set Up Prometheus for Time-Series Storage<\/h2><p class=\"wp-block-paragraph\"><strong>Prometheus<\/strong> is a time-series database and monitoring system that scrapes cAdvisor metrics endpoint and stores them for querying and alerting.<\/p><p class=\"wp-block-paragraph\">Create a Prometheus configuration file <code>prometheus.yml<\/code>:<\/p><pre class=\"wp-block-code\"><code>global:\\n  scrape_interval: 15s\\n  evaluation_interval: 15s\\n\\nscrape_configs:\\n  - job_name: cadvisor\\n    static_configs:\\n      - targets: [localhost:8080]<\/code><\/pre><p class=\"wp-block-paragraph\">Run Prometheus as a container, mounting the config file:<\/p><pre class=\"wp-block-code\"><code>docker run -d \\\n  --name=prometheus \\\n  --restart=unless-stopped \\\n  -p 9090:9090 \\\n  -v $(pwd)\/prometheus.yml:\/etc\/prometheus\/prometheus.yml \\\n  prom\/prometheus:latest<\/code><\/pre><p class=\"wp-block-paragraph\">Access the Prometheus UI at <code>http:\/\/&lt;your-vps-ip&gt;:9090<\/code>. You can run PromQL queries like <code>container_cpu_usage_seconds_total<\/code> or <code>container_memory_usage_bytes<\/code> to inspect container health over time.<\/p><h2 class=\"wp-block-heading\">Step 4: Add Grafana for Visual Dashboards (Optional)<\/h2><p class=\"wp-block-paragraph\">For a richer visualization, add Grafana on top of Prometheus:<\/p><pre class=\"wp-block-code\"><code>docker run -d \\\n  --name=grafana \\\n  --restart=unless-stopped \\\n  -p 3000:3000 \\\n  grafana\/grafana:latest<\/code><\/pre><p class=\"wp-block-paragraph\">Log in at <code>http:\/\/&lt;your-vps-ip&gt;:3000<\/code> (default admin\/admin), add Prometheus as a data source (<code>http:\/\/localhost:9090<\/code>), and import the community cAdvisor dashboard (ID 14282) for pre-built visualizations.<\/p><h2 class=\"wp-block-heading\">Step 5: Set Up Resource Alerts<\/h2><p class=\"wp-block-paragraph\">Create an alerting rule file <code>alerts.yml<\/code> to send notifications when containers exceed thresholds:<\/p><pre class=\"wp-block-code\"><code>groups:\\n  - name: container_alerts\\n    rules:\\n      - alert: HighContainerCPU\\n        expr: sum(rate(container_cpu_usage_seconds_total[1m])) by (name) &gt; 0.8\\n        for: 5m\\n        labels:\\n          severity: warning\\n        annotations:\\n          summary: Container {{ $labels.name }} CPU above 80% for 5 minutes\\n\\n      - alert: HighContainerMemory\\n        expr: container_memory_usage_bytes \/ container_spec_memory_limit_bytes &gt; 0.9\\n        for: 5m\\n        labels:\\n          severity: warning\\n        annotations:\\n          summary: Container {{ $labels.name }} memory above 90%<\/code><\/pre><p class=\"wp-block-paragraph\">Reference <code>alerts.yml<\/code> in your <code>prometheus.yml<\/code> under the <code>rule_files<\/code> directive and restart Prometheus.<\/p><h2 class=\"wp-block-heading\">Troubleshooting Common Issues<\/h2><ul class=\"wp-block-list\"><li><strong>cAdvisor shows no data<\/strong> \u2014 Ensure cAdvisor has access to <code>\/var\/lib\/docker<\/code> and the host filesystem. Re-run with <code>--privileged<\/code> flag.<\/li><li><strong>Prometheus cannot reach cAdvisor<\/strong> \u2014 Use <code>host.docker.internal:8080<\/code> instead of <code>localhost:8080<\/code> when running in Docker bridge network mode, or use <code>--network=host<\/code>.<\/li><li><strong>Grafana shows No data<\/strong> \u2014 Verify Prometheus data source URL is reachable from the Grafana container. Use <code>http:\/\/prometheus:9090<\/code> if both are on the same Docker network.<\/li><li><strong>High memory usage from monitoring stack<\/strong> \u2014 cAdvisor can use 100\u2013300 MB RAM on a busy host. Consider reducing <code>scrape_interval<\/code> to 30s or 60s on low-memory VPS plans.<\/li><\/ul><h2 class=\"wp-block-heading\">Conclusion<\/h2><p class=\"wp-block-paragraph\">This stack gives you container-level visibility from quick CLI checks (<code>docker stats<\/code>) to long-term trending and alerting (cAdvisor + Prometheus + Grafana). The setup runs comfortably on a 2 GB VPS with typical containerized workloads. For VPS recommendations that match your monitoring requirements, check <a href=\"https:\/\/virtualserversvps.com\/#providers\">our VPS comparison table<\/a> for CPU and RAM options.<\/p>","protected":false},"excerpt":{"rendered":"<p>When running containerized workloads on a VPS, monitoring resource utilization across containers becomes critical. Unlike traditional server monitoring, container monitoring must account for ephemeral instances, shared kernel resources, and dynamic&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-564","post","type-post","status-publish","format-standard","hentry","category-performance-optimization"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus - Virtual Servers VPS Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus\" \/>\n<meta property=\"og:description\" content=\"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-24T16:57:39+00:00\" \/>\n<meta name=\"author\" content=\"Virtual-Servers-Vps-Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virtual-Servers-Vps-Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/\",\"name\":\"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-07-24T16:57:39+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/\",\"name\":\"Virtual Servers VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\",\"name\":\"Virtual-Servers-Vps-Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"caption\":\"Virtual-Servers-Vps-Editor\"},\"sameAs\":[\"https:\/\/virtualserversvps.com\/blog\"],\"url\":\"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus - Virtual Servers VPS Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus","og_description":"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus","og_url":"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-07-24T16:57:39+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/","url":"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/","name":"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-07-24T16:57:39+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/container-monitoring-vps-docker-cadvisor-prometheus\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Set Up Container Monitoring on Your VPS: Docker Stats, cAdvisor, and Prometheus"}]},{"@type":"WebSite","@id":"https:\/\/virtualserversvps.com\/blog\/#website","url":"https:\/\/virtualserversvps.com\/blog\/","name":"Virtual Servers VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0","name":"Virtual-Servers-Vps-Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","caption":"Virtual-Servers-Vps-Editor"},"sameAs":["https:\/\/virtualserversvps.com\/blog"],"url":"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/"}]}},"_links":{"self":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/comments?post=564"}],"version-history":[{"count":1,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/564\/revisions"}],"predecessor-version":[{"id":705,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/564\/revisions\/705"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}