docker-compose fails to start cadvisor: "/dev/kmsg: no such file or directory"

error message

cig-cadvisor-1 | W1019 05:19:20.315901 1 manager.go:349] Could not configure a source for OOM detection, disabling OOM events: open /dev/kmsg: no such file or directory
cig-cadvisor-1 | F1019 05:19:20.379426 1 cadvisor.go:172] Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory
cig-cadvisor-1 exited with code 255

Configuration details

docker-compose.ymlThe content of the item about cadvisor in

  cadvisor:
    image: google/cadvisor
    links:
      - influxdb:influxsrv
    command: "-storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influxsrv:8086"
    restart: always
    ports:
      - 8080:8080
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro

❗❗The cause of the problem

/sys/fs/cgroup/cpuacct,cpuCheck this directory, there is no on my machine (CentOS 7)

Solution

There are other posts in the forum

mount -o remount,rw /sys/fs/cgroup
ln -s /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/cpuacct,cpu

other

You can also do mapping in the volumes field

volumes:
  - /sys/fs/cgroup/cpu,cpuacct:/sys/fs/cgroup/cpuacct,cpu

then it

You can also remove the mapping of the volumes field, but this way the container will not be visible

volumes:
  - /sys:/sys:ro

Guess you like

Origin blog.csdn.net/sean908/article/details/127407547
Recommended