Nomad LXC Driver Use Image


I will prefix by saying I am very new to LXC so apologies in advance for any really obvious questions…

I have just installed the Nomad LXC Driver and I can run the example job no problem. The difference is that the example application given with the driver is deploying a busybox container using an LXC template. What I now have is an LXC image that I have exported and now have a .tar.gz file. I would like to run that image but the driver expects a template to be given which seems to be some kind of a shell script.

There doesn’t seem to be many docs or other examples about the driver out there on the internet so I was wondering if anyone else had any extra insight? If I have to write a template then that is fine also but I can’t seem to be able to find any documentation on that either.

My end goal is to build a container image that includes my application and be able to deploy that image multiple times into the nomad cluster.

Any help would be hugely appreciated!


Thanks :slight_smile:


we’re not using it in production but considered it for quite some time and went through a intense protoype phase.

Here is what i learned back then:

Code your own lxc-template and use the template and template_args driver options.

A lxc-template is nothing more then a executable (shell script, python, go, …) stored in /usr/share/lxc/templates/lxc-yourtemplate. Such a template is a factory which produces new containers.

You can test your template like so:

lxc-create -t yourtemplate -n container1 -- arg1 arg2 arg3

The template can use any arguments to create the container directory in /var/lib/lxc, unpack your rootfs, write a config file etc. Best to have a look into the existing templates like “download” or “busybox” to learn about how it works.

It can further be used to download (wget/curl) your image from some another place to emulate a “pull image” operation. Alternatively it can be combined later with nomads artifact stanza etc.

Hope it helps you to get started.



1 Like