Could a profile include another profile?

Hi
If I’m not wrong, a profile cannot include another profile today. Wouldn’t it be a nice feature? Many major software use a “include” in their config file…
What do you think of it?

Hi!

You can stack profiles, instead.

If you want to apply two profiles on a container, you would do it as follows. The order of the profiles is important, as what comes later will override a setting of the previous profiles.

lxc launch ubuntu:18.04 mycontainer --profile default --profile x11

It’s indeed what I usually do… until last time where I forgot the
first profile and until I realized something was missing in my
container. Profile inclusion would have avoided that mistake, hence
my wish to have this feature.

You may make a feature request on https://github.com/lxc/lxd/issues
It is important to think how to best describe the request.

For example, you may ask for compound profiles, as in the following. The new profile myx11 is made of stacking together dedault and x11.

lxc profile compound create myx11 default x11

Or, add a keyword in profiles to make them dependent on some other profile.
That is, if you tried to lxc launch ubuntu: --profile x11 mycontainer, it would complain because x11 is not supposed to be specified alone.

Do note that feature requests are suggestions that the developers either may choose to implement, may keep for implementation sometime in the future, or decide not to implement.

We’ve had a feature request for profiles including profiles in the past but we ended up closing it as there wasn’t a very strong reason for that and it would cause a lot of headaches in figuring out apply order and having to detect and avoid loops.

I seem to recall that for that particular case, the fact that you can now tie profiles to images would actually end up covering that need.

Thanks all,
It’s maybe not as practical as the usual “conf.d” folder include mechanism usually found on linux, but that will make the deal.