Boot script when creating a LXD container

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.

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/

1 Like