Question: LXC/LXD with mender-client

Hello,

Context: Recently i was assigned with task to recreate Yocto image containing mender and my company app in such way that it would run in LXD container, since company that we are creating solutions for strongly depends on LXD.

The problem is that I have no idea how to get it working except for launching VM inside the container as it is done with mendersoftware/mender-client-qemu container. Root of the problem lies in the fact that my supervisors strongly prefer to have it running entirely inside a container.

As far as i am concerned containers does not have their own filesystem, since they mostly rely on the host in that field - and by that i mean they do not work like VM - having “their own universe”. Right now I am mostly concluded that doing it entirely in container is rather impossible. But as my last resort i decided to just ask here. If anybody is aware how to deploy yocto image with mender for container without using f.e. qemu inside of the container i will be really gracious for any tips and tricks.

Thanks ;D

Lxd supports containers and VM’s. When you create an lxd instance from an image you can specify --vm I believe to get a VM instance solely managed by lxd. I use a mixture of lxd containers and lxd VM’s in production.

The problem is they do not want it to work as a VM, my supervisor specified that it has to run purely as container - i don’t know why exactly :confused: .

Maybe i will rephrase the question - How to create Yocto image with mender that would run inside the LXD container without usage of VM inside the container? More specifically what is needed to be enabled in Yocto build as well as what need to be configured in LXD to make it happen?

Cheers

I’m not sure I fully understand the use case but Mender is not really designed to work in this fashion. If Mender is running inside the container then it will only be able to update items in the container and not in the base operating system. It’s intended to run as a daemon in the base operating system. You can use a custom update module to update containers from there though.

If you can lay out your use case in more detail, we can probably guide you further.

Drew

I guess you could take the single rootfs archive that’s produced by yocto build, and follow the lxd instructions to convert that archive into a lxd image, and the import into lxd. As @drewmoseley pointed out update module is probably as much of mender you could use take care not to try to update things that the container does not have access to change.
You also may need to change the mender config as you won’t have a data partition.

This is all in theory as i have never tried this

The thing is that I do not know what is the specific use case for that solution. How it was described to me went something along this lines:

Our client strongly prefer that we deploy our solutions in form of LXC containers, so try to figure out how to put that Yocto image you created into the container".

I guess if it is not possible to do that this way, then we will apply the update module strategy, of course if client will agree that we’ll put mender on their production server.
Otherwise we will scratch the whole idea.

Thanks for your feedback, stay well!