合 docker启动容器报错 Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error setting cgroup config for procHooks process: failed to write "a *:* rwm": write /sys/fs/cgroup/devices/docker/XXXXX/devices.allow: invalid argument: unknown
Tags: 故障处理Dockerdevices.allow
现象
1 2 3 4 5 6 | [root@mdw ~]# docker start lhrprometheus Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error setting cgroup config for procHooks process: failed to write "a *:* rwm": write /sys/fs/cgroup/devices/docker/042c625d3522ac6fc7e47a79c1d31c596c53f9f916341aa8d1b3f933dc9ba733/devices.allow: invalid argument: unknown Error: failed to start containers: lhrprometheus [root@mdw ~]# ll /sys/fs/cgroup/devices/docker/042c625d3522ac6fc7e47a79c1d31c596c53f9f916341aa8d1b3f933dc9ba733/devices.allow --w------- 1 root root 0 Feb 8 09:13 /sys/fs/cgroup/devices/docker/042c625d3522ac6fc7e47a79c1d31c596c53f9f916341aa8d1b3f933dc9ba733/devices.allow [root@mdw ~]# |
解决1
Docker 使用不同的 cgroup 驱动程序(如 cgroupfs 和 systemd)。如果 cgroup 驱动程序不兼容,可能会导致此类错误。你可以在 Docker 的配置文件中(通常是 /etc/docker/daemon.json
)检查或更改 cgroup 驱动程序。
例如,你可以将配置文件设置为使用 systemd:
1 2 3 4 | { "exec-opts": ["native.cgroupdriver=systemd"] } |