2015-11-04 531 views
0

我已经安装了LXC用于创建容器,我已经做了创建无特权的容器的命令,但是当我做我有这样的错误:LXC创建无特权的容器

[[email protected] lxc]$ lxc-create -t download -n prova0 
lxc-create: conf.c: chown_mapped_root: 3406 No mapping for container root 
lxc-create: lxccontainer.c: do_bdev_create: 943 Error chowning /home/andrea/.local/share/lxc/prova0/rootfs to container root 
lxc-create: conf.c: suggest_default_idmap: 4444 Your system is not configured with subuids 
lxc-create: lxccontainer.c: do_lxcapi_create: 1408 Error creating backing store type (none) for prova0 
lxc-create: lxc_create.c: main: 274 Error creating container prova0 
+1

试试这个奇妙手册https://www.stgraber.org/2014/01/17/lxc-1-0-unprivileged-containers/ – ipeacocks

回答

4
lxc-create: ... Your system is not configured with subuids 

按照上述错误消息,这听起来像你正在尝试创建一个没有配置子配置的无特权容器。这些步骤适用于Ubuntu 14.04,但我怀疑他们也会在Fedora上工作。

$ mkdir -p ~/.config/lxc 
$ echo "lxc.id_map = u 0 100000 65536" > ~/.config/lxc/default.conf 
$ echo "lxc.id_map = g 0 100000 65536" >> ~/.config/lxc/default.conf 
$ echo "lxc.network.type = veth" >> ~/.config/lxc/default.conf 
$ echo "lxc.network.link = lxcbr0" >> ~/.config/lxc/default.conf 
$ echo "$USER veth lxcbr0 2" | sudo tee -a /etc/lxc/lxc-usernet 

一旦这些配置,你应该能够创建一个Ubuntu的容器,如下:

$ lxc-create -t download -n u1 -- -d ubuntu -r trusty -a amd64 

从Ubuntu服务器LXC引导措施: https://help.ubuntu.com/lts/serverguide/lxc.html#lxc-unpriv