bmullan's picture

Finally got back around to looking at Turnkey LXC.

My host is ubuntu 14.04 on which I already do alot with lxc and somewhat with Docker.

I followed the example writeup for wordpress.

Created the /root/inithooks file with appropriate entries

Created an lxc-turnkey template in Ubuntu's  /usr/share/lxc/templates

Next I figured I could just try the example lxc-create command from the Turnkey documentation:

$ sudo lxc-create -n wp1 -t turnkey -- wordpress -i /root/inithooks.conf -l natbr0 -x

but this generated these error messages:

getopt: unrecognized option '--rootfs=/var/lib/lxc/wp1/rootfs'
lxc_container: container creation template for wp1 failed
lxc_container: Error creating container wp1

I know I can use the lxc-create -n turnkey -h command to get output from Turnkey's template about all the options it supports:

$ lxc-create -t turnkey -h
Usage: lxc-create --name=NAME [-w] [-r] [-t template] [-P lxcpath]

lxc-create creates a container

Options :
  -n, --name=NAME    NAME for name of the container
  -f, --config=file  Initial configuration file
  -t, --template=t   Template to use to setup container
  -B, --bdev=BDEV    Backing store type to use
  -P, --lxcpath=PATH Place container under PATH
  --lvname=LVNAME    Use LVM lv name LVNAME
                     (Default: container name)
  --vgname=VG        Use LVM vg called VG
                     (Default: lxc)
  --thinpool=TP      Use LVM thin pool called TP
                     (Default: lxc)
  --fstype=TYPE      Create fstype TYPE
                     (Default: ext3)
  --fssize=SIZE[U]   Create filesystem of size SIZE * unit U (bBkKmMgGtT)
                     (Default: 1G, default unit: M)
  --dir=DIR   Place rootfs directory under DIR
  --zfsroot=PATH     Create zfs under given zfsroot
                     (Default: tank/lxc)

Common options :
  -o, --logfile=FILE               Output log to FILE instead of stderr
  -l, --logpriority=LEVEL          Set log priority to LEVEL
  -q, --quiet                      Don't produce any output
  -P, --lxcpath=PATH               Use specified container path
  -?, --help                       Give this help list
      --usage                      Give a short usage message
      --version                    Print the version number

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

See the lxc-create man page for further information.

TurnKey LXC Template Syntax: appname [options]


appname Appliance name (e.g., core)


-a --arch= Appliance architecture (default: hosts architecture)
-v --version= Appliance version (default: 13.0-wheezy)
-c --cachedir= Path to appliance cache (default: /var/cache/lxc/turnkey)
-x --aptproxy= Address of APT Proxy (e.g.,

-i --inithooks= Path to inithooks.conf (e.g., /root/inithooks.conf)

-l --netlink= Value of (default: br0)
Specify none to omit network configuration

Required options (passed automatically by lxc-create):

-n --name= container name ($lxc_name)
-p --path= container path ($lxc_path/$lxc_name)

Example usage::

lxc-create -n core -t turnkey -- core -i /root/inithooks.conf

Like the error message above I do not see - -rootfs listed in the options for lxc-turkey template either but I was wondering if the intent was to use - -dir


Jeremy Davis's picture

TBH I'm still yet to play with the LXC builds so I can't offer any real advice or guidance. However your research appears sound. Have you tried it using the --dir switch instead?

Jeremy Davis's picture

Cool idea and thanks for sharing. :)

Add new comment