[Help] Newbie question about container configuration


#1

Hey new guy here trying to understand how LXC works.
When creating a container is there an option/ file that you can specify which requirements you want the envirenment to have and wich source code to run ? Like a docker file

otherwise how do you deploy an application on a LXC container?


(Idef1x) #2

LXC should be seen as a complete VM, not just an application container like docker.
You can launch a container and do your aaplication installation, publish it as image and then launch new containers from it as new application container alike. LXC just behaves more like a real machine than docker does. So for me it’s better :wink:

Still missing a LXD hub for premade images like the docker hub though…Sometimes I just peek at the docker hub and convert the Docker file into one to do the same for LXD…


#3

There are some automation tools that have also support for LXD (like Ansible, Vagrant).
If you are familiar with those, then you can use them.

Also, you can use cloud-init to launch containers with specific configuration.
See https://blog.simos.info/how-to-preconfigure-lxd-containers-with-cloud-init/ to get an idea how that works.

You can get a similar experience with Docker and Dockerfiles, by using distrobuilder. It’s a new tool for LXC/LXD and allows to generate container images based on stock images. There is a container description file that describes how to put together the container image. To have an idea how these work, have a look at https://blog.simos.info/how-to-create-a-minimal-container-image-for-lxc-lxd-with-distrobuilder/
The toolchain is there to create a hub of containers images for LXC/LXD.