1. 程式人生 > >cAdivisor正確安裝指南(市面上大部分都不可行)!

cAdivisor正確安裝指南(市面上大部分都不可行)!

cAdvisor安裝命令(Bug版本)

sudo docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/dev/disk/:/dev/disk:ro \
  --publish=8080:8080 \
  --detach=true \
  --name=cadvisor \
  google/cadvisor:latest

cAdvisor安裝過程中,遇到這樣的問題,如下所示:

I0920 13:34:52.582102       1 factory.go:356] Registering Docker factory
I0920 13:34:54.584719       1 factory.go:54] Registering systemd factory
I0920 13:34:54.592528       1 factory.go:86] Registering Raw factory
I0920 13:34:54.597054       1 manager.go:1178] Started watching for new ooms in manager
W0920 13:34:54.597109       1 manager.go:313] Could not configure a source for OOM detection, disabling OOM events: open /dev/kmsg: no such file or directory
I0920 13:34:54.611619       1 manager.go:329] Starting recovery of all containers
I0920 13:34:55.330465       1 manager.go:334] Recovery completed
F0920 13:34:55.330582       1 cadvisor.go:156] Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory

解決辦法

sudo docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/dev/disk/:/dev/disk:ro \
  --publish=8080:8080 \
  --detach=true \
  --name=cadvisor \
  google/cadvisor:v0.24.1