Skip to content

lxc init

Create instances from images

Synopsis

Description: Create instances from images

lxc init [<remote>:]<image> [<remote>:][<name>] [flags]

Examples

lxc init ubuntu:24.04 u1
    Create a container (but do not start it)

lxc init ubuntu:24.04 u1 < config.yaml
    Create a container with configuration from config.yaml

lxc init ubuntu:24.04 v1 --vm -c limits.cpu=4 -c limits.memory=4GiB
    Create a virtual machine with 4 vCPUs and 4GiB of RAM

lxc init ubuntu:24.04 v1 --vm -c limits.cpu=2 -c limits.memory=8GiB -d root,size=32GiB
    Create a virtual machine with 2 vCPUs, 8GiB of RAM and a root disk of 32GiB

Options

-c, --config        Config key/value to apply to the new instance
-d, --device        New key/value to apply to a specific device
    --empty         Create an empty instance
-e, --ephemeral     Ephemeral instance
-n, --network       Network name
    --no-profiles   Create the instance with no profiles applied
-p, --profile       Profile to apply to the new instance
-s, --storage       Storage pool name
    --target        Cluster member name
-t, --type          Instance type
    --vm            Create a virtual machine

Options inherited from parent commands

    --debug          Show all debug messages
    --force-local    Force using the local unix socket
-h, --help           Print help
    --project        Override the source project
-q, --quiet          Don't show progress information
    --sub-commands   Use with help or --help to view sub-commands
-v, --verbose        Show all information messages
    --version        Print version number

SEE ALSO

  • lxc - Command line client for LXD