Search code examples
ubuntulxc

Create an LXC container from a local template (tar.gz)


I'm trying to create an LXC container from a local tar.gz of a rootfs of another container but I could not find any option in lxc-create to do so. I can create a new container, remove its rootfs and replace that with my untared rootfs but this is too clumsy. Is there a better way to do this?


Solution

  • After a bit of searching I found this script which takes a tar.gz and creates an LXC container.

    $ lxc-create -n test-container -t ./salt_tarball -- --network_link lxcbr0 --imgtar /root/template.tar.gz
    

    note here that salt_tarball is the name of the script.