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

  Note: The --project flag sets the project for both the image remote and the instance remote.
  If the image remote is a public remote (e.g. simplestreams) then this project is ignored by the image remote.
  If the image remote is another LXD server, specify the source project for the image remote 
  with --project and the instance remote with --target-project (if different from --project).

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
      --target-project   Project to create the instance in (if different from --project)
  -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