lxc-profile
Manage LXC container configuration profiles
TLDR
List all available profiles
Show the configuration of a specific profile
Edit a specific profile in the default editor
Edit a specific profile importing the configuration values from a file
Launch a new container with specific profiles
Change the profiles of a running container
SYNOPSIS
lxc profile subcommand [arguments...]
PARAMETERS
list
Lists all available LXD profiles.
show profile_name
Displays the YAML configuration of a specific profile.
create profile_name
Creates a new empty profile.
edit profile_name
Opens the specified profile's configuration in a text editor for modification.
apply container_name profile_name [profile_name...]
Applies one or more profiles to a specified container. Multiple profiles are merged, with later ones taking precedence.
delete profile_name
Deletes an existing profile.
rename old_profile_name new_profile_name
Renames an existing profile.
copy source_profile destination_profile
Copies an existing profile to a new one.
DESCRIPTION
The `lxc-profile` command is an integral part of the LXD command-line client, specifically designed for managing container profiles. In the context of LXD, a profile is a named collection of configuration options and devices that can be easily applied to one or more containers. This mechanism allows administrators to define and reuse common configurations, such as network settings, resource limits, storage mounts, or specific device passthroughs.
By leveraging profiles, organizations can ensure consistency across their container deployments, standardize environments, and significantly reduce the overhead associated with configuring individual containers. The `lxc-profile` command provides a comprehensive set of subcommands to interact with these profiles, enabling users to list existing profiles, show their detailed configurations, create new ones, edit their properties, copy or rename them, delete unneeded profiles, and most importantly, apply them to containers. This centralized profile management approach enhances the flexibility and scalability of LXD-based container infrastructures.
CAVEATS
Profiles are powerful tools that can significantly alter container behavior and security. Extreme care should be exercised when editing or applying them, especially in production environments.
When multiple profiles are applied to a container, their configurations are merged. In cases where the same configuration key is defined in multiple profiles, the setting from the last applied profile (or the one appearing last in the container's configuration output) takes precedence.
Deleting a profile using `lxc profile delete` does not automatically remove it from containers it's already applied to. Containers will continue to operate with the configuration they had before the profile's deletion until their configuration is explicitly updated.
DEFAULT PROFILE
LXD automatically creates a 'default' profile upon initialization. This profile is typically applied to all new containers by default, providing essential configurations like basic network connectivity. Users can modify this default profile or explicitly specify other profiles during container creation to override its settings.
PROFILE MERGING AND PRECEDENCE
When a container has multiple profiles assigned, LXD merges their configurations. If a specific configuration key or device is defined in more than one applied profile, the setting from the profile that appears last in the container's list of applied profiles takes precedence. This order of precedence is crucial for understanding the final configuration of a container.
HISTORY
The concept of profiles was introduced early in LXD's development, building upon the success of LXC. As a daemon designed for system containers, LXD needed a robust mechanism to manage common configurations efficiently. Profiles filled this gap, allowing for standardized environments and simplifying the deployment of complex container setups. The `lxc-profile` command provides the primary command-line interface for interacting with this powerful profile management system, evolving alongside LXD to support new features and configuration options.
SEE ALSO
lxc(1), lxc-config(1), lxc-launch(1), lxc-container(7)