如何在没有rootfs的情况下创建LXC容器

Moj*_*aba 7 lxc

我想在lxc 1.0.5和Ubuntu 14.04中创建一个没有"rootfs"的容器.

我之前在lxc的早期版本中做过.在以前的版本中,如果我们使用不带"-t"选项的lxc-create,它将创建一个没有"rootfs"的容器.

所以我尝试:

lxc-create -n foo
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误:

lxc_container: Error creating container foo
Run Code Online (Sandbox Code Playgroud)

我阅读了新的lxc-create手册页.新的联机帮助页说:

       -t template
              'template' is the short name of an existing 'lxc-template'
              script that is called by lxc-create, eg. busybox, debian,
              fedora, ubuntu or sshd.  Refer to the examples in
              /usr/local/share/lxc/templates for details of the expected
              script structure.  Alternatively, the full path to an
              executable template script can also be passed as a parameter.
              "none" can be used to force lxc-create to skip rootfs
              creation.

我试试看:

lxc-create -n foo -t none
Run Code Online (Sandbox Code Playgroud)

我又得到了错误:

lxc_container: No such file or directory - bad template: none
lxc_container: bad template: none
lxc_container: Error creating container foo
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

Sea*_*rth 12

当现实发生变化时,你不是讨厌它,但文档不是吗?

尝试使用-t/bin/true