容器名称:vm1
配置:
lxc.tty = 4
lxc.pts = 1024
lxc.rootfs = /var/lib/lxc/vm1/rootfs
lxc.mount.entry = sysfs /var/lib/lxc/vm1/rootfs/sys sysfs defaults 0 0
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.veth.pair = veth_vm1
lxc.cgroup.memory.limit_in_bytes = 512M
lxc.cgroup.memory.memsw.limit_in_bytes = 1G
lxc.utsname = vm1
lxc.cgroup.devices.deny = a
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
lxc.cgroup.devices.allow = c 254:0 rwm
lxc.cgroup.devices.allow = c 10:200 rwm
启动容器时出现以下错误?可能是内存设置问题吗?
$ lxc-start -n vm1
// error
lxc-start: cgroup is not mounted
lxc-start: failed to setup the cgroups for 'vm1'
lxc-start: failed to setup the container
lxc-start: invalid sequence number 1. expected 2
lxc-start: failed to spawn 'vm1'
答案1
您需要安装 cgroup 文件系统。如果这是 RHEL/CentOS,请确保您已libcgroup
安装。