How can I use a container created with LXD on a system running only LXC?

I have a container created in LXD that I want to deploy with a host. This host offers only LXC.

How can I make my container work on a system with only LXC installed?

1 Like

I have the same issue I have a host which provisions LXD container and I need to ‘convert’ them to LXC.

I tried a few things:

  1. Pointing the --lxcpath to the LXD directory (/var/snap/lxd/common/lxd/storage-pools/defaultainers/)
  2. Copy the rootfs to the lxcpath

Both without much success.

Is this possible to achieve? Installing LXD is not an option for my usecase.
(I think it should since LXD as fare as I understand it is just a frontend to LXC but I don’t see how it would work)

You’ll also need to get the lxc.conf file from /var/snap/lxd/common/lxd/logs/ and put that as config, then likely do a bunch of changes in there for the various paths, remove the hooks, …

1 Like

Yeah I figured out that adding a basic config file does the trick.
(Also using the same version of LXC in LXD and on the LXC host helped)

But this is the only way?
There is no support in LXD to export a container with the config file?

Correct, the config file is a LXC thing which LXD doesn’t use internally, instead we just render it as needed when talking to liblxc.

When you export a LXD container, what you get instead is the LXD configuration.

1 Like