Boot script when creating a LXD container

lxd

(Aj Nouri) #1

Hi everyone,
Is there a way to run a script when creating a new container from an image?
The goal is to have a container with preconfigured apps/actions.

Thanks in advance.


#2

You can use cloud-init, if the container image supports it. The Ubuntu container images support cloud-init.

Here is a how-to,
https://blog.simos.info/how-to-preconfigure-lxd-containers-with-cloud-init/