Docker

How do you monitor Docker containers on a VPS?

What goes wrong with Docker on a single VPS: restart loops, unbounded JSON logs, dangling images filling the disk. Fix it without docker exec.

In short

To monitor Docker containers on a VPS, watch four things the Docker daemon will not warn you about: containers in a restart loop, per-container JSON logs growing without a cap, images and build cache filling the disk, and a database container with its port published to the internet. Opservo reads these from the Docker socket, clusters container logs, and includes the fix for each.

What fails on Docker hosts that nobody notices?

  • •A container with restart: always crashing every 30 seconds; docker ps says "Up 12 seconds" forever
  • •JSON log files under /var/lib/docker/containers growing to tens of gigabytes because no max-size was set
  • •Dangling images, stopped containers and build cache eating the root volume after months of deploys
  • •A MySQL, Postgres, Redis or Mongo container started with -p 3306:3306 and no firewall, reachable from the internet
  • •A container quietly OOM-killed and restarted, losing in-memory state each time
  • •Memory and CPU limits absent, so one container can starve the host

What does Opservo collect from Docker?

From the Docker socket, read-only: every container with its image, state, restart count, published ports and resource usage, and container logs, which are clustered into patterns and summarized rather than stored raw. Databases running as containers are inspected with docker exec status commands, so MySQL, Redis and PostgreSQL in containers get the same insights as on the host. Volume-level disk growth is forecast by the Watchdog.

What should alert?

  • •A container that has restarted more than three times, which means it crashes shortly after starting
  • •A database container port published on 0.0.0.0 with no firewall rule, as a security critical
  • •Disk growth projected to fill the volume, with the prune and log-cap fix
  • •A recurring error pattern in a container’s logs that was not there yesterday

What are the fixes?

# why is it restarting
docker logs --tail 100 <name>
docker inspect <name> --format "{{.State.ExitCode}} {{.State.OOMKilled}}"
# reclaim space
docker system prune -af
# cap logs for every new container: /etc/docker/daemon.json
{ "log-opts": { "max-size": "50m", "max-file": "3" } }
# publish a database only on localhost
-p 127.0.0.1:3306:3306

Each of these is attached to the matching Opservo finding and can be run from the dashboard on servers with remote actions enabled. A crashed container restart is a good first autonomous policy.

Last updated 2026-09-23.

FAQ

Related questions

What should Docker container monitoring cover?+

Five things. Container state and restart count, because a container stuck in a restart loop is the most common silent failure. CPU and memory use per container. Disk used by images, volumes and container logs, which is what usually fills a VPS. The container’s own logs, so a crash comes with its last error. And the host underneath, since every container shares its disk, memory and kernel. Opservo’s agent reads containers straight from the Docker socket on every heartbeat, with no exporter or sidecar, and reports the host alongside them.

Do I need cAdvisor or a Prometheus exporter?+

No. The agent reads the Docker socket directly and reports containers, resources and disk usage on every heartbeat. Metrics can still be exported to Prometheus or Grafana from Opservo if you want your own dashboards.

Does it monitor Docker Compose stacks?+

Yes. Compose services are ordinary containers to the Docker socket; each appears with its state, restarts and clustered logs like any other container.

What about Kubernetes?+

Kubernetes clusters use a separate read-only in-cluster agent that reports workloads, pods, crash loops with exit codes and log tails, resources and events. It is installed with one kubectl apply.

Are container logs stored?+

Not raw. The agent ships normalized entries; the API keeps only clustered patterns with counts and an AI summary, so log volume does not affect price or privacy.