Using OCI templates in LXD

TIL the difference between lxc-start and lxc start etc commands.

Both LXD 3.0 and LXC 3.0 have some really exciting features, e.g. clustering and OCI support, respectively. Am I able to use both of these? Specifically, there a way to launch an OCI image from LXD 3.0 (using the lxd launch command)?

I feel I may be missing something…

My understanding is that LXD is simply a wrapper of LXC that enables remote connections and a suite of other functionality.

What I’m confused by is why LXD 3.0 (installed via Snap) which includes LXC 3.0 does not have OCI support. What is the missing link?

1 Like

I really could use some guidance here.

I’ve built systems that run millions of containers every year using LXD, yet I seem to be missing the connection (or lack thereof) between LXD 3.0 and the functionality introduced in LXC 3.0.

I’d appreciate some guidance one way or another. I’m excited to try the new versions!

LXC is a project centered around a library, liblxc which allows for the creation of containers of any type from userspace. It also provides a set of tools (lxc-*) that allows interacting with that C library and offers a pretty low level user interface.

LXD is a container manager that focuses on system containers and which uses liblxc through go-lxc. It offers a very opinionated, user experience that was designed from the ground up to allow for the easy creation of system containers, exposing the features user expect in a way that doesn’t require an advanced understanding of the various kernel components at play.

LXD is also network aware, offers remote management of containers, image servers and clustering.

So LXD does use liblxc as its runtime and relies on it for most kernel interactions but it also has a lot of logic of its own to deal with more abstract concepts that LXC doesn’t know about (infiniband, sriov, gpus, abstract resource limits, cpu scheduling, networking, …).

1 Like

Thanks for the response @stgraber.

What I am trying to do is utilize the new OCI templates in LXC via LXD. According to this function call in lxc/go-lxc it appears that a template is passed to the create function in lxc/lxc here (and therefore made available via this function which I presume is what lxc/lxd uses).

So then I guess my question really is: can I can provide OCI templates to LXD since they are now supported by liblxc?

No you can’t, OCI templates are for application containers, LXD only does system containers.
LXD images also don’t use the liblxc template mechanism at all, instead LXD prepares the container filesystem on its own.

1 Like

Gotcha. Thanks for all the info, will mark this post as resolved.

You can always use lxc-create to generate the LXC image and then convert it to a LXD image.