云主机层面

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

docker-compose.yml文件

---
version: "3"

networks:
  yunwei:

services:
  cadvisor:
    image: google/cadvisor:latest
    entrypoint:
      - /usr/bin/cadvisor
      - -logtostderr
    restart: always
    ports:
      - 58081:8080
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
    privileged:
      true
    networks:
      yunwei:

如果遇到问题

docker-compose down --remove-orphans
systemctl restart docker
mount -o remount,rw '/sys/fs/cgroup'
ln -s /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/cpuacct,cpu
最后修改:2024 年 05 月 11 日
如果觉得我的文章对你有用,请随意赞赏