阿里云ECS安装Cadvisor报错
安装命令:
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=8090:8080 --detach=true --name=cadvisor google/cadvisor
注意要用最新的镜像,第一次我用 google/cadvisor:v0.24.1镜像,报如下错,搞了很久:
[root@master ~]# docker logs cadvisor
I0424 02:20:22.317461 1 storagedriver.go:50] Caching stats in memory for 2m0s
I0424 02:20:22.317661 1 manager.go:140] cAdvisor running in container: "/docker/b62e41dcbb05423ea71132b925063f7a57691460f121952f82e4cdda7fea1d0
c"fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x63 pc=0x7f11b97b01ed]
runtime stack:
runtime.throw(0xfdc760, 0x2a)
/home/stclair/.gvm/gos/go1.6.3/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
/home/stclair/.gvm/gos/go1.6.3/src/runtime/sigpanic_unix.go:12 +0x5a
goroutine 14 [syscall, locked to thread]:
runtime.cgocall(0xabb6c0, 0xc820033bd8, 0x0)
/home/stclair/.gvm/gos/go1.6.3/src/runtime/cgocall.go:123 +0x11b fp=0xc820033b78 sp=0xc820033b48
net._C2func_getaddrinfo(0x7f11a80008c0, 0x0, 0xc820198c90, 0xc8201161c8, 0x0, 0x0, 0x0)
??:0 +0x55 fp=0xc820033bd8 sp=0xc820033b78
启动后还有报错的话如下解决:
[root@master ~]# docker logs cadvisor
W0424 02:23:46.543998 1 manager.go:349] Could not configure a source for OOM detection, disabling OOM events: open /dev/kmsg: no such file or d
irectoryF0424 02:23:46.571058 1 cadvisor.go:172] Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or direc
tory[root@master ~]# mount -o remount,rw '/sys/fs/cgroup'
[root@master ~]# ln -s /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/cpuacct,cpu
[root@master ~]# docker start cadvisor