Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
When I launch a new container I can specify which profile it should take instead of the default profile with the
lxc launch [<remote>:]<image> -p <some profile>
This profile can contain some default network setup (bridge, devices, ...) and the container won't work properly if you don't launch it with the correct profile.
It would be nice if you could specify a custom default profile to take when launching a container from a specific image instead of the real default profile. This could look something like this:
lxc image edit <image>
With the option:
# ... properties: default_profile: <profile> # ...
Of course it would be nice to also include this option in the metadata.yaml file for importing an image
This topic was already mentioned in a linux container discussion thread but I wanted to know if there is anything planed like this.
That's come up a couple of times. It wouldn't be something that we'd store as part of the image itself as we don't want the image producer to be able to trick users into using a particular profile, but I'd be fine with it being something that the local admin can mark an image with, so that any container created from it after that would use the profiles.
Thanks, assigned to you.
For this issue, I think we want to extend the returned image structs to include a list of profiles to apply at creation time if none were provided by the user. When not set, the "default" profile will be assumed.
From a user's point of view, this will be visible in:
This will show as a new "profiles" field which will default to nil.
There will be three valid values for it:
One catch is projects as projects may contain images and profiles but it's not guaranteed that both feature will be used together.
As a result, I think we'll want this list of profiles to be tied to the project and will become tied to the project if it has either the images or profiles feature enabled.
As for how to split this work, I'd suggest the following commits:
One last thing to keep in mind, images can get refreshed by LXD. When this happens, we'll want those profiles to be copied to the new image.
Let me know if you have any questions or run into any problem!