Search code examples
lxc

How to create a LXC container without rootfs


I want to create a container without "rootfs" in lxc 1.0.5 and Ubuntu 14.04.

I did it before in previous versions of lxc. In previous versions if we use lxc-create without "-t" option, it will create a container without "rootfs".

so I try:

lxc-create -n foo

and i got this error:

lxc_container: Error creating container foo

I read new lxc-create manpage. The new manpage say:

       -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.

I try it:

lxc-create -n foo -t none

and i get error again:

lxc_container: No such file or directory - bad template: none
lxc_container: bad template: none
lxc_container: Error creating container foo

What am i doing wrong?


Solution

  • Don't you hate it when reality changes, but the documentation doesn't?

    Try using -t /bin/true