| Current Path : /snap/lxd/current/share/lxd-documentation/howto/instances_create/ |
| Current File : //snap/lxd/current/share/lxd-documentation/howto/instances_create/index.html |
<!doctype html>
<html class="no-js" lang="en" data-content_root="../../">
<head><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="How to create instances" />
<meta property="og:type" content="website" />
<meta property="og:url" content="/howto/instances_create/" />
<meta property="og:site_name" content="LXD documentation" />
<meta property="og:description" content="When creating an instance, you must specify the image on which the instance should be based. Images contain a basic operating system (for example, a Linux distribution) and some LXD-related informa..." />
<meta property="og:image" content="https://documentation.ubuntu.com/lxd/latest/_static/lxd_tag.png" />
<meta property="og:image:alt" content="LXD documentation" />
<meta name="description" content="When creating an instance, you must specify the image on which the instance should be based. Images contain a basic operating system (for example, a Linux distribution) and some LXD-related informa..." />
<meta property="article:modified_time" content="2025-06-06T12:49:39+00:00" /><link rel="index" title="Index" href="../../genindex/"><link rel="search" title="Search" href="../../search/"><link rel="next" title="How to configure instances" href="../instances_configure/"><link rel="prev" title="Instances" href="../../instances/">
<link rel="canonical" href="/howto/instances_create/">
<link rel="shortcut icon" href="../../_static/favicon.ico"><!-- Generated with Sphinx 7.4.7 and Furo 2025.12.19 -->
<title>How to create instances - LXD documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=d111a655" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=7bdb33bb" />
<link rel="stylesheet" type="text/css" href="../../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../../_static/config-options.css" />
<link rel="stylesheet" type="text/css" href="../../_static/related-links.css" />
<link rel="stylesheet" type="text/css" href="../../_static/terminal.css" />
<link rel="stylesheet" type="text/css" href="../../_static/youtube.css" />
<link rel="stylesheet" type="text/css" href="../../_static/sphinx-design.min.css?v=95c83b7e" />
<link rel="stylesheet" type="text/css" href="../../_static/tabs.css?v=a5c4661c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo-extensions.css?v=8dab3a3b" />
<link rel="stylesheet" type="text/css" href="../../_static/lxd_custom.css?v=bfbf4da2" />
<link rel="stylesheet" type="text/css" href="../../_static/cookie-banner.css?v=b74831ab" />
<link rel="stylesheet" type="text/css" href="../../_static/custom.css?v=e189117a" />
<link rel="stylesheet" type="text/css" href="../../_static/header.css?v=a8078839" />
<link rel="stylesheet" type="text/css" href="../../_static/github_issue_links.css?v=3d761185" />
<link rel="stylesheet" type="text/css" href="../../_static/furo_colors.css?v=825fec6f" />
</head>
<body>
<header id="header" class="p-navigation">
<!-- Google Tag Manager -->
<script>
(function(w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0];
var j = d.createElement(s);
var dl = '';
if (l != 'dataLayer') {
dl = '&l=' + l;
}
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-KNX3CJC');
</script>
<div class="p-navigation__nav" role="menubar">
<ul class="p-navigation__links" role="menu">
<li>
<a class="p-logo" href="https://canonical.com/lxd" aria-current="page">
<img src="../../_static/lxd_tag.png" alt="Logo" class="p-logo-image">
<div class="p-logo-text p-heading--4">LXD
</div>
</a>
</li>
<li class="nav-ubuntu-com">
<a href="https://canonical.com/lxd" class="p-navigation__link">canonical.com/lxd</a>
</li>
<li class="nav-dropdown">
<a href="#" class="p-navigation__link nav-more-links"
id="more-resources-toggle"
aria-haspopup="true"
aria-expanded="false">
More resources
</a>
<ul class="more-links-dropdown" aria-labelledby="more-resources-toggle">
<li>
<a href="https://discourse.ubuntu.com/c/lxd/" class="p-navigation__sub-link p-dropdown__link">Discourse</a>
</li>
<li>
<a href="https://matrix.to/#/#documentation:ubuntu.com" class="p-navigation__sub-link p-dropdown__link">Matrix</a>
</li>
<li>
<a href="https://github.com/canonical/lxd" class="p-navigation__sub-link p-dropdown__link">GitHub</a>
</li>
</ul>
</li>
</ul>
</div>
</header>
<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
</script>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-toc" viewBox="0 0 24 24">
<title>Contents</title>
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
</svg>
</symbol>
<symbol id="svg-menu" viewBox="0 0 24 24">
<title>Menu</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</symbol>
<symbol id="svg-arrow-right" viewBox="0 0 24 24">
<title>Expand</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</symbol>
<symbol id="svg-sun" viewBox="0 0 24 24">
<title>Light mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</symbol>
<symbol id="svg-moon" viewBox="0 0 24 24">
<title>Dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
</svg>
</symbol>
<symbol id="svg-sun-with-moon" viewBox="0 0 24 24">
<title>Auto light/dark, in light mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
class="icon-custom-derived-from-feather-sun-and-tabler-moon">
<path style="opacity: 50%" d="M 5.411 14.504 C 5.471 14.504 5.532 14.504 5.591 14.504 C 3.639 16.319 4.383 19.569 6.931 20.352 C 7.693 20.586 8.512 20.551 9.25 20.252 C 8.023 23.207 4.056 23.725 2.11 21.184 C 0.166 18.642 1.702 14.949 4.874 14.536 C 5.051 14.512 5.231 14.5 5.411 14.5 L 5.411 14.504 Z"/>
<line x1="14.5" y1="3.25" x2="14.5" y2="1.25"/>
<line x1="14.5" y1="15.85" x2="14.5" y2="17.85"/>
<line x1="10.044" y1="5.094" x2="8.63" y2="3.68"/>
<line x1="19" y1="14.05" x2="20.414" y2="15.464"/>
<line x1="8.2" y1="9.55" x2="6.2" y2="9.55"/>
<line x1="20.8" y1="9.55" x2="22.8" y2="9.55"/>
<line x1="10.044" y1="14.006" x2="8.63" y2="15.42"/>
<line x1="19" y1="5.05" x2="20.414" y2="3.636"/>
<circle cx="14.5" cy="9.55" r="3.6"/>
</svg>
</symbol>
<symbol id="svg-moon-with-sun" viewBox="0 0 24 24">
<title>Auto light/dark, in dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
class="icon-custom-derived-from-feather-sun-and-tabler-moon">
<path d="M 8.282 7.007 C 8.385 7.007 8.494 7.007 8.595 7.007 C 5.18 10.184 6.481 15.869 10.942 17.24 C 12.275 17.648 13.706 17.589 15 17.066 C 12.851 22.236 5.91 23.143 2.505 18.696 C -0.897 14.249 1.791 7.786 7.342 7.063 C 7.652 7.021 7.965 7 8.282 7 L 8.282 7.007 Z"/>
<line style="opacity: 50%" x1="18" y1="3.705" x2="18" y2="2.5"/>
<line style="opacity: 50%" x1="18" y1="11.295" x2="18" y2="12.5"/>
<line style="opacity: 50%" x1="15.316" y1="4.816" x2="14.464" y2="3.964"/>
<line style="opacity: 50%" x1="20.711" y1="10.212" x2="21.563" y2="11.063"/>
<line style="opacity: 50%" x1="14.205" y1="7.5" x2="13.001" y2="7.5"/>
<line style="opacity: 50%" x1="21.795" y1="7.5" x2="23" y2="7.5"/>
<line style="opacity: 50%" x1="15.316" y1="10.184" x2="14.464" y2="11.036"/>
<line style="opacity: 50%" x1="20.711" y1="4.789" x2="21.563" y2="3.937"/>
<circle style="opacity: 50%" cx="18" cy="7.5" r="2.169"/>
</svg>
</symbol>
<symbol id="svg-pencil" viewBox="0 0 24 24">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-pencil-code">
<path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" />
<path d="M13.5 6.5l4 4" />
<path d="M20 21l2 -2l-2 -2" />
<path d="M17 17l-2 2l2 2" />
</svg>
</symbol>
<symbol id="svg-eye" viewBox="0 0 24 24">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-eye-code">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
<path
d="M11.11 17.958c-3.209 -.307 -5.91 -2.293 -8.11 -5.958c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6c-.21 .352 -.427 .688 -.647 1.008" />
<path d="M20 21l2 -2l-2 -2" />
<path d="M17 17l-2 2l2 2" />
</svg>
</symbol>
</svg>
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation" aria-label="Toggle site navigation sidebar">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc" aria-label="Toggle table of contents sidebar">
<label class="overlay sidebar-overlay" for="__navigation"></label>
<label class="overlay toc-overlay" for="__toc"></label>
<a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a>
<div class="page">
<header class="mobile-header">
<div class="header-left">
<label class="nav-overlay-icon" for="__navigation">
<span class="icon"><svg><use href="#svg-menu"></use></svg></span>
</label>
</div>
<div class="header-center">
<a href="../../"><div class="brand">LXD documentation</div></a>
</div>
<div class="header-right">
<div class="theme-toggle-container theme-toggle-header">
<button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme">
<svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
<svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-header-icon" for="__toc">
<span class="icon"><svg><use href="#svg-toc"></use></svg></span>
</label>
</div>
</header>
<aside class="sidebar-drawer">
<div class="sidebar-container">
<div class="sidebar-sticky"><a class="sidebar-brand" href="../../">
<span class="sidebar-brand-text">LXD documentation</span>
</a><form class="sidebar-search-container" method="get" action="../../search/" role="search">
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
<input type="submit" value="Go">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../">LXD</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tutorial/first_steps/">Tutorial</a></li>
<li class="toctree-l1 current has-children"><a class="reference internal" href="../">How-to guides</a><input aria-label="Toggle navigation of How-to guides" checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul class="current">
<li class="toctree-l2 has-children"><a class="reference internal" href="../../getting_started/">Getting started</a><input aria-label="Toggle navigation of Getting started" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../installing/">Install LXD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../initialize/">Initialize LXD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../access_ui/">Access the UI</a></li>
<li class="toctree-l3"><a class="reference internal" href="../access_documentation/">Access documentation locally</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../operation/">LXD server and client</a><input aria-label="Toggle navigation of LXD server and client" class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" role="switch" type="checkbox"/><label for="toctree-checkbox-3"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../server_expose/">Expose LXD to the network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../server_configure/">Configure the LXD server</a></li>
<li class="toctree-l3 has-children"><a class="reference internal" href="../oidc/">Configure single sign-on with OIDC</a><input aria-label="Toggle navigation of Configure single sign-on with OIDC" class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" role="switch" type="checkbox"/><label for="toctree-checkbox-4"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l4"><a class="reference internal" href="../oidc_auth0/">How to configure Auth0</a></li>
<li class="toctree-l4"><a class="reference internal" href="../oidc_ory/">How to configure Ory Hydra</a></li>
<li class="toctree-l4"><a class="reference internal" href="../oidc_keycloak/">How to configure Keycloak</a></li>
<li class="toctree-l4"><a class="reference internal" href="../oidc_entra_id/">How to configure Entra ID</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../remotes/">Add remote servers</a></li>
<li class="toctree-l3"><a class="reference internal" href="../lxc_alias/">Add command aliases</a></li>
</ul>
</li>
<li class="toctree-l2 current has-children"><a class="reference internal" href="../../instances/">Instances</a><input aria-label="Toggle navigation of Instances" checked="" class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" role="switch" type="checkbox"/><label for="toctree-checkbox-5"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul class="current">
<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">Create instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_configure/">Configure instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_manage/">Manage instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../profiles/">Use profiles</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_troubleshoot/">Troubleshoot errors</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_ubuntu_pro_attach/">Auto attach Ubuntu Pro</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_access_files/">Access files</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_console/">Access the console</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../instance-exec/">Run commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../cloud-init/">Use cloud-init</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_routed_nic_vm/">Add a routed NIC to a VM</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_backup/">Back up instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_migrate/">Migrate instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../import_machines_to_instances/">Import existing machines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../container_gpu_passthrough_with_docker/">Pass NVIDIA GPUs</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../images/">Images</a><input aria-label="Toggle navigation of Images" class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" role="switch" type="checkbox"/><label for="toctree-checkbox-6"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../images_remote/">Use remote images</a></li>
<li class="toctree-l3"><a class="reference internal" href="../images_manage/">Manage images</a></li>
<li class="toctree-l3"><a class="reference internal" href="../images_profiles/">Associate profiles</a></li>
<li class="toctree-l3"><a class="reference internal" href="../images_copy/">Copy and import images</a></li>
<li class="toctree-l3"><a class="reference internal" href="../images_create/">Create images</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../projects/">Projects</a><input aria-label="Toggle navigation of Projects" class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" role="switch" type="checkbox"/><label for="toctree-checkbox-7"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../projects_create/">Create and configure</a></li>
<li class="toctree-l3"><a class="reference internal" href="../projects_work/">Work with projects</a></li>
<li class="toctree-l3"><a class="reference internal" href="../projects_confine/">Confine users to projects</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../storage/">Storage</a><input aria-label="Toggle navigation of Storage" class="toctree-checkbox" id="toctree-checkbox-8" name="toctree-checkbox-8" role="switch" type="checkbox"/><label for="toctree-checkbox-8"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../storage_pools/">Manage pools</a></li>
<li class="toctree-l3"><a class="reference internal" href="../storage_volumes/">Manage volumes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../storage_buckets/">Manage buckets</a></li>
<li class="toctree-l3"><a class="reference internal" href="../storage_create_instance/">Create an instance in a pool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../storage_backup_volume/">Back up a volume</a></li>
<li class="toctree-l3"><a class="reference internal" href="../storage_move_volume/">Move or copy a volume</a></li>
<li class="toctree-l3"><a class="reference internal" href="../storage_csi/">Use the LXD CSI driver with Kubernetes</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../networks/">Networking</a><input aria-label="Toggle navigation of Networking" class="toctree-checkbox" id="toctree-checkbox-9" name="toctree-checkbox-9" role="switch" type="checkbox"/><label for="toctree-checkbox-9"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../network_create/">Create a network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_configure/">Configure a network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_bgp/">Configure as BGP server</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_acls/">Configure network ACLs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_forwards/">Configure forwards</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_zones/">Configure network zones</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_bridge_firewalld/">Configure your firewall</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_bridge_resolved/">Integrate with resolved</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_ovn_setup/">Set up OVN</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_load_balancers/">Configure load balancers</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_ovn_peers/">Configure peer routing</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_ipam/">Display IPAM information</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../clustering/">Clustering</a><input aria-label="Toggle navigation of Clustering" class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" role="switch" type="checkbox"/><label for="toctree-checkbox-10"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../cluster_form/">Form a cluster</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cluster_manage/">Manage a cluster</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cluster_config_networks/">Configure networks</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cluster_config_storage/">Configure storage</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cluster_manage_instance/">Manage instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cluster_groups/">Set up cluster groups</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cluster_placement_groups/">Use placement groups</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cluster_recover/">Recover a cluster</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cluster_vip/">Set up a highly available virtual IP</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../production-setup/">Production setup</a><input aria-label="Toggle navigation of Production setup" class="toctree-checkbox" id="toctree-checkbox-11" name="toctree-checkbox-11" role="switch" type="checkbox"/><label for="toctree-checkbox-11"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../benchmark_performance/">Benchmark performance</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network_increase_bandwidth/">Increase bandwidth</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../metrics/">Monitor metrics</a></li>
<li class="toctree-l3"><a class="reference internal" href="../logs_loki/">Send logs to Loki</a></li>
<li class="toctree-l3"><a class="reference internal" href="../grafana/">Set up Grafana</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../backup/">Back up a server</a></li>
<li class="toctree-l3"><a class="reference internal" href="../disaster_recovery/">Recover instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../disaster_recovery_replication/">Disaster recovery with storage replication</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../snap/">Manage the snap</a></li>
<li class="toctree-l2"><a class="reference internal" href="../security_harden/">Harden security</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshoot/">Troubleshooting</a><input aria-label="Toggle navigation of Troubleshooting" class="toctree-checkbox" id="toctree-checkbox-12" name="toctree-checkbox-12" role="switch" type="checkbox"/><label for="toctree-checkbox-12"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../network_bridge_firewalld/">Configure your firewall</a></li>
<li class="toctree-l3"><a class="reference internal" href="../instances_troubleshoot/">Troubleshoot instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="../dqlite_troubleshoot/">Troubleshoot Dqlite</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../debugging/">Debug LXD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../faq/">Frequently asked</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../support/">Get support</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../contributing/">Contribute to LXD</a></li>
<li class="toctree-l2"><a class="reference internal" href="../auth_bearer/">How to authenticate to the LXD API using bearer tokens</a></li>
<li class="toctree-l2"><a class="reference internal" href="../devlxd_authenticate/">How to authenticate to the DevLXD API</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../explanation/">Explanation</a><input aria-label="Toggle navigation of Explanation" class="toctree-checkbox" id="toctree-checkbox-13" name="toctree-checkbox-13" role="switch" type="checkbox"/><label for="toctree-checkbox-13"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/lxd_lxc/"><code class="docutils literal notranslate"><span class="pre">lxd</span></code> and <code class="docutils literal notranslate"><span class="pre">lxc</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/instances/">Containers and VMs</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../image-handling/">Local and remote images</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/storage/">Storage pools, volumes, and buckets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/networks/">Networking setups</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../database/">The LXD Dqlite database</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/lxc_show_info/"><code class="docutils literal notranslate"><span class="pre">lxc</span></code> <code class="docutils literal notranslate"><span class="pre">show</span></code> and <code class="docutils literal notranslate"><span class="pre">info</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../../authentication/">Remote API authentication</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/authorization/">Remote API authorization</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/projects/">Instances grouping with projects</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/clusters/">Clusters</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/performance_tuning/">Performance tuning</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/security/">Security</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/bpf/">Privilege delegation using BPF Token</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../explanation/csi/">The LXD CSI driver</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../reference/">Reference</a><input aria-label="Toggle navigation of Reference" class="toctree-checkbox" id="toctree-checkbox-14" name="toctree-checkbox-14" role="switch" type="checkbox"/><label for="toctree-checkbox-14"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../requirements/">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../architectures/">Architectures</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../reference/release-notes/">Release notes</a><input aria-label="Toggle navigation of Release notes" class="toctree-checkbox" id="toctree-checkbox-15" name="toctree-checkbox-15" role="switch" type="checkbox"/><label for="toctree-checkbox-15"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/release-notes/release-notes-6.7/">LXD 6.7</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/release-notes/release-notes-6.6/">LXD 6.6</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/releases-snap/">Releases and snap</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/remote_image_servers/">Remote image servers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/image_format/">Image format</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../guest-os-compatibility/">Guest OS compatibility</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../container-environment/">Container environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../config-options/">Configuration option index</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../server/">Server configuration</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../explanation/instance_config/">Instance configuration</a><input aria-label="Toggle navigation of Instance configuration" class="toctree-checkbox" id="toctree-checkbox-16" name="toctree-checkbox-16" role="switch" type="checkbox"/><label for="toctree-checkbox-16"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/instance_properties/">Instance properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/instance_options/">Instance options</a></li>
<li class="toctree-l3 has-children"><a class="reference internal" href="../../reference/devices/">Devices</a><input aria-label="Toggle navigation of Devices" class="toctree-checkbox" id="toctree-checkbox-17" name="toctree-checkbox-17" role="switch" type="checkbox"/><label for="toctree-checkbox-17"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l4"><a class="reference internal" href="../../reference/standard_devices/">Standard devices</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_none/">Type: <code class="docutils literal notranslate"><span class="pre">none</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_nic/">Type: <code class="docutils literal notranslate"><span class="pre">nic</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_disk/">Type: <code class="docutils literal notranslate"><span class="pre">disk</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_unix_char/">Type: <code class="docutils literal notranslate"><span class="pre">unix-char</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_unix_block/">Type: <code class="docutils literal notranslate"><span class="pre">unix-block</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_usb/">Type: <code class="docutils literal notranslate"><span class="pre">usb</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_gpu/">Type: <code class="docutils literal notranslate"><span class="pre">gpu</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_infiniband/">Type: <code class="docutils literal notranslate"><span class="pre">infiniband</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_proxy/">Type: <code class="docutils literal notranslate"><span class="pre">proxy</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_unix_hotplug/">Type: <code class="docutils literal notranslate"><span class="pre">unix-hotplug</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_tpm/">Type: <code class="docutils literal notranslate"><span class="pre">tpm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../reference/devices_pci/">Type: <code class="docutils literal notranslate"><span class="pre">pci</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/instance_units/">Units for storage and network limits</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/preseed_yaml_fields/">Preseed YAML file fields</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/projects/">Project configuration</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../reference/storage_drivers/">Storage drivers</a><input aria-label="Toggle navigation of Storage drivers" class="toctree-checkbox" id="toctree-checkbox-18" name="toctree-checkbox-18" role="switch" type="checkbox"/><label for="toctree-checkbox-18"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_dir/">Directory - <code class="docutils literal notranslate"><span class="pre">dir</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_btrfs/">Btrfs - <code class="docutils literal notranslate"><span class="pre">btrfs</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_lvm/">LVM - <code class="docutils literal notranslate"><span class="pre">lvm</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_zfs/">ZFS - <code class="docutils literal notranslate"><span class="pre">zfs</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_ceph/">Ceph RBD - <code class="docutils literal notranslate"><span class="pre">ceph</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_powerflex/">Dell PowerFlex - <code class="docutils literal notranslate"><span class="pre">powerflex</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_pure/">Pure Storage - <code class="docutils literal notranslate"><span class="pre">pure</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_alletra/">HPE Alletra - <code class="docutils literal notranslate"><span class="pre">alletra</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_cephfs/">CephFS - <code class="docutils literal notranslate"><span class="pre">cephfs</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/storage_cephobject/">Ceph Object - <code class="docutils literal notranslate"><span class="pre">cephobject</span></code></a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../reference/networks/">Networks</a><input aria-label="Toggle navigation of Networks" class="toctree-checkbox" id="toctree-checkbox-19" name="toctree-checkbox-19" role="switch" type="checkbox"/><label for="toctree-checkbox-19"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_bridge/">Bridge network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_ovn/">OVN network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_macvlan/">Macvlan network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_physical/">Physical network</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/network_sriov/">SR-IOV network</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/cluster_member_config/">Cluster configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/placement_groups/">Placement group configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/server_settings/">Production server settings</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/provided_metrics/">Provided metrics</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/permissions/">Permissions</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../restapi_landing/">REST API</a><input aria-label="Toggle navigation of REST API" class="toctree-checkbox" id="toctree-checkbox-20" name="toctree-checkbox-20" role="switch" type="checkbox"/><label for="toctree-checkbox-20"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../rest-api/">Main API documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api/">Main API specification</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api-extensions/">Main API extensions</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../events/">Events API documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev-lxd/">Instance API</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../reference/driver_csi/">LXD CSI driver reference</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../reference/manpages/">Man pages</a><input aria-label="Toggle navigation of Man pages" class="toctree-checkbox" id="toctree-checkbox-21" name="toctree-checkbox-21" role="switch" type="checkbox"/><label for="toctree-checkbox-21"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../reference/manpages/lxc/"><code class="docutils literal notranslate"><span class="pre">lxc</span></code></a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../internals/">Internals</a><input aria-label="Toggle navigation of Internals" class="toctree-checkbox" id="toctree-checkbox-22" name="toctree-checkbox-22" role="switch" type="checkbox"/><label for="toctree-checkbox-22"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../environment/">Environment variables</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/uefi_variables/">UEFI variables for VMs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../daemon-behavior/">Daemon behavior</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../syscall-interception/">System call interception</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../userns-idmap/">User namespace setup</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/ovn-internals/">OVN implementation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/vm_live_migration_internals/">VM live migration implementation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../reference/dqlite-internals/">Dqlite</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference external" href="https://github.com/canonical/lxd">Project repository</a></li>
<li class="toctree-l2"><a class="reference external" href="https://images.lxd.canonical.com">Image server</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</aside>
<div class="main">
<div class="content">
<div class="article-container">
<a href="#" class="back-to-top muted-link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
</svg>
<span>Back to top</span>
</a>
<div class="content-icon-container">
<div class="edit-this-page">
<a class="muted-link" href="https://github.com/canonical/lxd/edit/main/doc/howto/instances_create.md" title="Contribute to this page">
<svg><use href="#svg-pencil"></use></svg>
<span class="visually-hidden">Contribute to this page</span>
</a>
</div><div class="theme-toggle-container theme-toggle-content">
<button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme">
<svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
<svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-content-icon" for="__toc">
<span class="icon"><svg><use href="#svg-toc"></use></svg></span>
</label>
</div>
<article role="main" id="furo-main-content">
<section id="how-to-create-instances">
<span id="instances-create"></span><h1>How to create instances<a class="headerlink" href="#how-to-create-instances" title="Link to this heading">¶</a></h1>
<p>When creating an instance, you must specify the <a class="reference internal" href="../../image-handling/#about-images"><span class="std std-ref">image</span></a> on which the instance should be based.</p>
<p>Images contain a basic operating system (for example, a Linux distribution) and some LXD-related information.
Images for various operating systems are available on the built-in remote image servers.
See <a class="reference internal" href="../../images/#images"><span class="std std-ref">Images</span></a> for more information.</p>
<p>If you don’t specify a name for the instance, LXD will automatically generate one.
Instance names must be unique within a LXD deployment (also within a cluster).
See <a class="reference internal" href="../../reference/instance_properties/#instance-name-requirements"><span class="std std-ref">Instance name requirements</span></a> for additional requirements.</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-0-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-0-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-0-QVBJ" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-0-QVBJ" name="QVBJ" role="tab" tabindex="-1">API</button><button aria-controls="panel-0-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-0-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-0-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-0-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><p>To create an instance, you can use either the <a class="reference internal" href="../../reference/manpages/lxc/init/#lxc-init-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">init</span></code></span></a> or the <a class="reference internal" href="../../reference/manpages/lxc/launch/#lxc-launch-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">launch</span></code></span></a> command.
The <a class="reference internal" href="../../reference/manpages/lxc/init/#lxc-init-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">init</span></code></span></a> command only creates the instance, while the <a class="reference internal" href="../../reference/manpages/lxc/launch/#lxc-launch-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">launch</span></code></span></a> command creates and starts it.</p>
<p>Enter the following command to create a container:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc launch|init <image_server>:<image_name> <instance_name> [flags]
</pre></div>
</div>
<p>Unless the image is available locally, you must specify the name of the image server and the name of the image (for example, <code class="docutils literal notranslate"><span class="pre">ubuntu:24.04</span></code> for the official Ubuntu 24.04 LTS image).</p>
<p>See <a class="reference internal" href="../../reference/manpages/lxc/launch/#lxc-launch-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">launch</span> <span class="pre">--help</span></code></span></a> or <a class="reference internal" href="../../reference/manpages/lxc/init/#lxc-init-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">init</span> <span class="pre">--help</span></code></span></a> for a full list of flags.
The most common flags are:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">--config</span></code> to specify a configuration option for the new instance</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--device</span></code> to override <a class="reference internal" href="../../reference/devices/#devices"><span class="std std-ref">device options</span></a> for a device provided through a profile, or to specify an <a class="reference internal" href="../../reference/devices_disk/#devices-disk-initial-config"><span class="std std-ref">initial configuration for the root disk device</span></a> (syntax: <code class="docutils literal notranslate"><span class="pre">--device</span> <span class="pre"><device_name>,<device_option>=<value></span></code>)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--profile</span></code> to specify a <a class="reference internal" href="../../profiles/#profiles"><span class="std std-ref">profile</span></a> to use for the new instance</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--network</span></code> or <code class="docutils literal notranslate"><span class="pre">--storage</span></code> to make the new instance use a specific network or storage pool</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--target</span></code> to create the instance on a specific cluster member</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--vm</span></code> to create a virtual machine instead of a container</p></li>
</ul>
<p>Instead of specifying the instance configuration as flags, you can pass it to the command as a YAML file.</p>
<p>For example, to launch a container with the configuration from <code class="docutils literal notranslate"><span class="pre">config.yaml</span></code>, enter the following command:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc launch ubuntu:24.04 ubuntu-config < config.yaml
</pre></div>
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>Check the contents of an existing instance configuration (<a class="reference internal" href="../../reference/manpages/lxc/config/show/#lxc-config-show-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">config</span> <span class="pre">show</span> <span class="pre"><instance_name></span> <span class="pre">--expanded</span></code></span></a>) to see the required syntax of the YAML file.</p>
</div>
</div><div aria-labelledby="tab-0-QVBJ" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-0-QVBJ" name="QVBJ" role="tabpanel" tabindex="0"><p>To create an instance, send a POST request to the <code class="docutils literal notranslate"><span class="pre">/1.0/instances</span></code> endpoint:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances --data '{
"name": "<instance_name>",
"source": {
"alias": "<image_alias>",
"protocol": "simplestreams",
"server": "<server_URL>",
"type": "image"
}
}'
</pre></div>
</div>
<p>The return value of this query contains an operation ID, which you can use to query the status of the operation:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request GET /1.0/operations/<operation_ID>
</pre></div>
</div>
<p>Use the following query to monitor the state of the instance:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request GET /1.0/instances/<instance_name>/state
</pre></div>
</div>
<p>See <a class="reference external" href="/api/#/instances/instances_post"><code class="docutils literal notranslate"><span class="pre">POST</span> <span class="pre">/1.0/instances</span></code></a> and <a class="reference external" href="/api/#/instances/instance_state_get"><code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/1.0/instances/{name}/state</span></code></a> for more information.</p>
<p>The request creates the instance, but does not start it.
To start an instance, send a PUT request to change the instance state:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request PUT /1.0/instances/<instance_name>/state --data '{"action": "start"}'
</pre></div>
</div>
<p>See <a class="reference internal" href="../instances_manage/#instances-manage-start"><span class="std std-ref">Start an instance</span></a> for more information.</p>
<p>If you would like to start the instance upon creation, set the <code class="docutils literal notranslate"><span class="pre">start</span></code> property to true. The following example will create the container, then start it:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances --data '{
"name": "<instance_name>",
"source": {
"alias": "<image_alias>",
"protocol": "simplestreams",
"server": "<server_URL>",
"type": "image"
},
"start": true
}'
</pre></div>
</div>
</div><div aria-labelledby="tab-0-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-0-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>To create an instance, go to the <span class="guilabel">Instances</span> section and click <span class="guilabel">Create instance</span>.</p>
<p>On the resulting screen, optionally enter a name and description for the instance.
Then click <span class="guilabel">Browse images</span> to select the image to be used for the instance.
Depending on the selected image, you might be able to select the <a class="reference internal" href="../../explanation/instances/#expl-instances"><span class="std std-ref">instance type</span></a> (container or virtual machine).
You can also specify one or more profiles to use for the instance.</p>
<p>To further tweak the instance configuration or add devices to the instance, go to any of the tabs under <span class="guilabel">Advanced</span>.
You can also edit the full instance configuration on the <span class="guilabel">YAML configuration</span> tab.</p>
<p>Finally, click <span class="guilabel">Create</span> or <span class="guilabel">Create and start</span> to create the instance.</p>
</div></div>
<section id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Link to this heading">¶</a></h2>
<p>The following CLI and API examples create the instances, but don’t start them.
If you are using the CLI client, you can use <a class="reference internal" href="../../reference/manpages/lxc/launch/#lxc-launch-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">launch</span></code></span></a> instead of <a class="reference internal" href="../../reference/manpages/lxc/init/#lxc-init-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">init</span></code></span></a> to automatically start them after creation.</p>
<p>In the UI, you can choose between <span class="guilabel">Create</span> and <span class="guilabel">Create and start</span> when you are ready to create the instance.</p>
<section id="create-a-container">
<h3>Create a container<a class="headerlink" href="#create-a-container" title="Link to this heading">¶</a></h3>
<p>To create a container with an Ubuntu 24.04 LTS image from the <code class="docutils literal notranslate"><span class="pre">ubuntu</span></code> server using the instance name <code class="docutils literal notranslate"><span class="pre">ubuntu-container</span></code>:</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-1-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-1-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-1-QVBJ" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-1-QVBJ" name="QVBJ" role="tab" tabindex="-1">API</button><button aria-controls="panel-1-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-1-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-1-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-1-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc init ubuntu:24.04 ubuntu-container
</pre></div>
</div>
</div><div aria-labelledby="tab-1-QVBJ" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-1-QVBJ" name="QVBJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances --data '{
"name": "ubuntu-container",
"source": {
"alias": "24.04",
"protocol": "simplestreams",
"server": "https://cloud-images.ubuntu.com/releases/",
"type": "image"
}
}'
</pre></div>
</div>
</div><div aria-labelledby="tab-1-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-1-VUk=" name="VUk=" role="tabpanel" tabindex="0"><figure class="align-default">
<a class="reference internal image-reference" href="../../_images/create_instance_ex1.png"><img alt="Create an Ubuntu 24.04 LTS container" src="../../_images/create_instance_ex1.png" style="width: 80%;" />
</a>
</figure>
</div></div>
</section>
<section id="create-a-virtual-machine">
<h3>Create a virtual machine<a class="headerlink" href="#create-a-virtual-machine" title="Link to this heading">¶</a></h3>
<p>To create a virtual machine with an Ubuntu 24.04 LTS image from the <code class="docutils literal notranslate"><span class="pre">ubuntu</span></code> server using the instance name <code class="docutils literal notranslate"><span class="pre">ubuntu-vm</span></code>:</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-2-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-2-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-2-QVBJ" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-2-QVBJ" name="QVBJ" role="tab" tabindex="-1">API</button><button aria-controls="panel-2-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-2-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-2-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-2-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc init ubuntu:24.04 ubuntu-vm --vm
</pre></div>
</div>
</div><div aria-labelledby="tab-2-QVBJ" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-2-QVBJ" name="QVBJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances --data '{
"name": "ubuntu-vm",
"source": {
"alias": "24.04",
"protocol": "simplestreams",
"server": "https://cloud-images.ubuntu.com/releases/",
"type": "image"
},
"type": "virtual-machine"
}'
</pre></div>
</div>
</div><div aria-labelledby="tab-2-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-2-VUk=" name="VUk=" role="tabpanel" tabindex="0"><figure class="align-default">
<a class="reference internal image-reference" href="../../_images/create_instance_ex2.png"><img alt="Create an Ubuntu 24.04 LTS VM" src="../../_images/create_instance_ex2.png" style="width: 80%;" />
</a>
</figure>
</div></div>
<p>Or with a bigger disk:</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-3-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-3-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-3-QVBJ" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-3-QVBJ" name="QVBJ" role="tab" tabindex="-1">API</button><button aria-controls="panel-3-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-3-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-3-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-3-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc init ubuntu:24.04 ubuntu-vm-big --vm --device root,size=30GiB
</pre></div>
</div>
</div><div aria-labelledby="tab-3-QVBJ" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-3-QVBJ" name="QVBJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances --data '{
"devices": {
"root": {
"path": "/",
"pool": "default",
"size": "30GiB",
"type": "disk"
}
},
"name": "ubuntu-vm-big",
"source": {
"alias": "24.04",
"protocol": "simplestreams",
"server": "https://cloud-images.ubuntu.com/releases/",
"type": "image"
},
"type": "virtual-machine"
}'
</pre></div>
</div>
</div><div aria-labelledby="tab-3-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-3-VUk=" name="VUk=" role="tabpanel" tabindex="0"><figure class="align-default">
<a class="reference internal image-reference" href="../../_images/create_instance_ex2-2.png"><img alt="Configure the size of the root disk" src="../../_images/create_instance_ex2-2.png" style="width: 80%;" />
</a>
</figure>
</div></div>
</section>
<section id="create-a-container-with-specific-configuration-options">
<h3>Create a container with specific configuration options<a class="headerlink" href="#create-a-container-with-specific-configuration-options" title="Link to this heading">¶</a></h3>
<p>To create a container and limit its resources to one vCPU and 8 GiB of RAM:</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-4-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-4-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-4-QVBJ" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-4-QVBJ" name="QVBJ" role="tab" tabindex="-1">API</button><button aria-controls="panel-4-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-4-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-4-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-4-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc init ubuntu:24.04 ubuntu-limited --config limits.cpu=1 --config limits.memory=8GiB
</pre></div>
</div>
</div><div aria-labelledby="tab-4-QVBJ" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-4-QVBJ" name="QVBJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances --data '{
"config": {
"limits.cpu": "1",
"limits.memory": "8GiB"
},
"name": "ubuntu-limited",
"source": {
"alias": "24.04",
"protocol": "simplestreams",
"server": "https://cloud-images.ubuntu.com/releases/",
"type": "image"
}
}'
</pre></div>
</div>
</div><div aria-labelledby="tab-4-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-4-VUk=" name="VUk=" role="tabpanel" tabindex="0"><figure class="align-default">
<a class="reference internal image-reference" href="../../_images/create_instance_ex3.png"><img alt="Configure resource limits" src="../../_images/create_instance_ex3.png" style="width: 80%;" />
</a>
</figure>
</div></div>
</section>
<section id="create-a-vm-on-a-specific-cluster-member">
<h3>Create a VM on a specific cluster member<a class="headerlink" href="#create-a-vm-on-a-specific-cluster-member" title="Link to this heading">¶</a></h3>
<p>To create a virtual machine on the cluster member <code class="docutils literal notranslate"><span class="pre">micro2</span></code>, enter the following command:</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-5-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-5-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-5-QVBJ" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-5-QVBJ" name="QVBJ" role="tab" tabindex="-1">API</button><button aria-controls="panel-5-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-5-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-5-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-5-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc init ubuntu:24.04 ubuntu-vm-server2 --vm --target micro2
</pre></div>
</div>
</div><div aria-labelledby="tab-5-QVBJ" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-5-QVBJ" name="QVBJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances?target=micro2 --data '{
"name": "ubuntu-vm-server2",
"source": {
"alias": "24.04",
"protocol": "simplestreams",
"server": "https://cloud-images.ubuntu.com/releases/",
"type": "image"
},
"type": "virtual-machine"
}'
</pre></div>
</div>
</div><div aria-labelledby="tab-5-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-5-VUk=" name="VUk=" role="tabpanel" tabindex="0"><figure class="align-default">
<a class="reference internal image-reference" href="../../_images/create_instance_ex4.png"><img alt="Specify which cluster member to create an instance on" src="../../_images/create_instance_ex4.png" style="width: 80%;" />
</a>
</figure>
</div></div>
</section>
<section id="create-a-container-with-a-specific-instance-type">
<h3>Create a container with a specific instance type<a class="headerlink" href="#create-a-container-with-a-specific-instance-type" title="Link to this heading">¶</a></h3>
<p>LXD supports simple instance types for clouds.
Those are represented as a string that can be passed at instance creation time.</p>
<p>The list of supported clouds and instance types can be found at <a class="reference external" href="https://images.lxd.canonical.com/meta/instance-types/all.yaml"><code class="docutils literal notranslate"><span class="pre">images.lxd.canonical.com/meta/instance-types/all.yaml</span></code></a>.</p>
<p>The syntax allows the three following forms:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre"><instance</span> <span class="pre">type></span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre"><cloud>:<instance</span> <span class="pre">type></span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c<CPU>-m<RAM</span> <span class="pre">in</span> <span class="pre">GiB></span></code></p></li>
</ul>
<p>For example, the following three instance types are equivalent:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">t2.micro</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">aws:t2.micro</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c1-m1</span></code></p></li>
</ul>
<p>To create a container with this instance type:</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-6-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-6-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-6-QVBJ" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-6-QVBJ" name="QVBJ" role="tab" tabindex="-1">API</button><button aria-controls="panel-6-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-6-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-6-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-6-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc init ubuntu:24.04 my-instance --type t2.micro
</pre></div>
</div>
</div><div aria-labelledby="tab-6-QVBJ" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-6-QVBJ" name="QVBJ" role="tabpanel" tabindex="0"><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances --data '{
"instance_type": "t2.micro",
"name": "my-instance",
"source": {
"alias": "24.04",
"protocol": "simplestreams",
"server": "https://cloud-images.ubuntu.com/releases/",
"type": "image"
}
}'
</pre></div>
</div>
</div><div aria-labelledby="tab-6-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-6-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>Creating an instance with a specific cloud instance type is currently not possible through the UI.
Configure the corresponding options manually or through a profile.</p>
</div></div>
</section>
<section id="create-a-vm-that-boots-from-an-iso">
<span id="instances-create-iso"></span><h3>Create a VM that boots from an ISO<a class="headerlink" href="#create-a-vm-that-boots-from-an-iso" title="Link to this heading">¶</a></h3>
<p>To create a VM that boots from an ISO:</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-7-Q0xJ" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-7-Q0xJ" name="Q0xJ" role="tab" tabindex="0">CLI</button><button aria-controls="panel-7-QVBJ" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-7-QVBJ" name="QVBJ" role="tab" tabindex="-1">API</button><button aria-controls="panel-7-VUk=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-7-VUk=" name="VUk=" role="tab" tabindex="-1">UI</button></div><div aria-labelledby="tab-7-Q0xJ" class="sphinx-tabs-panel group-tab" id="panel-7-Q0xJ" name="Q0xJ" role="tabpanel" tabindex="0"><!-- iso_vm_step1 start -->
<p>First, create an empty VM that we can later install from the ISO image:</p>
<!-- iso_vm_step1 end -->
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc init iso-vm --empty --vm --config limits.cpu=2 --config limits.memory=4GiB --device root,size=30GiB
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Adapt the <code class="docutils literal notranslate"><span class="pre">limits.cpu</span></code>, <code class="docutils literal notranslate"><span class="pre">limits.memory</span></code>, and root size based on the hardware recommendations for the ISO image used.</p>
</div>
<!-- iso_vm_step2 start -->
<p>The second step is to import an ISO image that can later be attached to the VM as a storage volume:</p>
<!-- iso_vm_step2 end -->
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc storage volume import <pool> <path-to-image.iso> iso-volume --type=iso
</pre></div>
</div>
<!-- iso_vm_step3 start -->
<p>Lastly, attach the custom ISO volume to the VM using the following command:</p>
<!-- iso_vm_step3 end -->
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc config device add iso-vm iso-volume disk pool=<pool> source=iso-volume boot.priority=10
</pre></div>
</div>
<!-- iso_vm_step4 start -->
<p>The <a class="configref reference internal" href="../../reference/devices_disk/#device-disk-device-conf:boot.priority"><code class="docutils literal notranslate"><span class="pre">boot.priority</span></code></a> configuration key ensures that the VM will boot from the ISO first.
Start the VM and <a class="reference internal" href="../instances_console/#instances-console"><span class="std std-ref">connect to the console</span></a> as there might be a menu you need to interact with:</p>
<!-- iso_vm_step4 end -->
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc start iso-vm --console
</pre></div>
</div>
<!-- iso_vm_step5 start -->
<p>Once you’re done in the serial console, disconnect from the console using <kbd class="kbd docutils literal notranslate">Ctrl</kbd>+<kbd class="kbd docutils literal notranslate">a</kbd> <kbd class="kbd docutils literal notranslate">q</kbd> and <a class="reference internal" href="../instances_console/#instances-console"><span class="std std-ref">connect to the VGA console</span></a> using the following command:</p>
<!-- iso_vm_step5 end -->
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc console iso-vm --type=vga
</pre></div>
</div>
<!-- iso_vm_step6 start -->
<p>You should now see the installer. After the installation is done, detach the custom ISO volume:</p>
<!-- iso_vm_step6 end -->
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc storage volume detach <pool> iso-volume iso-vm
</pre></div>
</div>
<!-- iso_vm_step7 start -->
<p>Now the VM can be rebooted, and it will boot from disk.</p>
<!-- iso_vm_step7 end -->
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>On Linux virtual machines, the <a class="reference internal" href="#lxd-agent-manual-install"><span class="std std-ref">LXD agent can be manually installed</span></a>.</p>
</div>
</div><div aria-labelledby="tab-7-QVBJ" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-7-QVBJ" name="QVBJ" role="tabpanel" tabindex="0"><p>First, create an empty VM that we can later install from the ISO image:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances --data '{
"name": "iso-vm",
"config": {
"limits.cpu": "2",
"limits.memory": "4GiB"
},
"devices": {
"root": {
"path": "/",
"pool": "default",
"size": "30GiB",
"type": "disk"
}
},
"source": {
"type": "none"
},
"type": "virtual-machine"
}'
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Adapt the values for <code class="docutils literal notranslate"><span class="pre">limits.cpu</span></code>, <code class="docutils literal notranslate"><span class="pre">limits.memory</span></code>, and <code class="docutils literal notranslate"><span class="pre">root:</span> <span class="pre">size</span></code> based on the hardware recommendations for the ISO image used.</p>
</div>
<p>The second step is to import an ISO image that can later be attached to the VM as a storage volume:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>curl -X POST -H "Content-Type: application/octet-stream" -H "X-LXD-name: iso-volume" \
-H "X-LXD-type: iso" --data-binary @<path-to-image.iso> --unix-socket /var/snap/lxd/common/lxd/unix.socket \
lxd/1.0/storage-pools/<pool>/volumes/custom
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>When importing an ISO image, you must send both binary data from a file and additional headers.
The <a class="reference internal" href="../../reference/manpages/lxc/query/#lxc-query-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">query</span></code></span></a> command cannot do this, so you need to use <code class="docutils literal notranslate"><span class="pre">curl</span></code> or another tool instead.</p>
</div>
<p>Lastly, attach the custom ISO volume to the VM using the following command:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request PATCH /1.0/instances/iso-vm --data '{
"devices": {
"iso-volume": {
"boot.priority": "10",
"pool": "<pool>",
"source": "iso-volume",
"type": "disk"
}
}
}'
</pre></div>
</div>
<p>The <a class="configref reference internal" href="../../reference/devices_disk/#device-disk-device-conf:boot.priority"><code class="docutils literal notranslate"><span class="pre">boot.priority</span></code></a> configuration key ensures that the VM will boot from the ISO first.
Start the VM and <a class="reference internal" href="../instances_console/#instances-console"><span class="std std-ref">connect to the console</span></a> as there might be a menu you need to interact with:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request PUT /1.0/instances/iso-vm/state --data '{"action": "start"}'
lxc query --request POST /1.0/instances/iso-vm/console --data '{
"height": 24,
"type": "console",
"width": 80
}'
</pre></div>
</div>
<p>Once you’re done in the serial console, disconnect from the console using <kbd class="kbd docutils literal notranslate">Ctrl</kbd>+<kbd class="kbd docutils literal notranslate">a</kbd> <kbd class="kbd docutils literal notranslate">q</kbd> and <a class="reference internal" href="../instances_console/#instances-console"><span class="std std-ref">connect to the VGA console</span></a> using the following command:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request POST /1.0/instances/iso-vm/console --data '{
"height": 24,
"type": "vga",
"width": 80
}'
</pre></div>
</div>
<p>You should now see the installer. After the installation is done, detach the custom ISO volume:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc query --request GET /1.0/instances/iso-vm
lxc query --request PUT /1.0/instances/iso-vm --data '{
[...]
"devices": {}
[...]
}'
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>You cannot remove the device through a PATCH request, but you must use a PUT request.
Therefore, get the current configuration first and then provide the relevant configuration with an empty devices list through the PUT request.</p>
</div>
<p>Now the VM can be rebooted, and it will boot from disk.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> :end-before:
</pre></div>
</div>
</div><div aria-labelledby="tab-7-VUk=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-7-VUk=" name="VUk=" role="tabpanel" tabindex="0"><p>In the <span class="guilabel">Create instance</span> dialog, click <span class="guilabel">Use custom ISO</span> instead of <span class="guilabel">Browse images</span>.
You can then upload your ISO file and install a VM from it.</p>
</div></div>
</section>
<section id="install-the-lxd-agent-into-virtual-machine-instances">
<span id="lxd-agent-manual-install"></span><h3>Install the LXD agent into virtual machine instances<a class="headerlink" href="#install-the-lxd-agent-into-virtual-machine-instances" title="Link to this heading">¶</a></h3>
<p>In order for features like direct command execution (<code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">exec</span></code> & <code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">shell</span></code>), file transfers (<code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">file</span></code>) and detailed usage metrics (<code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">info</span></code>)
to work properly with virtual machines, an agent software is provided by LXD.</p>
<p>The virtual machine images from the official <a class="reference internal" href="../../reference/remote_image_servers/#remote-image-servers"><span class="std std-ref">remote image servers</span></a> are pre-configured to load that agent on startup.</p>
<p>For other virtual machines, you may want to manually install the agent.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The LXD agent is currently available only on Linux virtual machines using <code class="docutils literal notranslate"><span class="pre">systemd</span></code>.</p>
</div>
<p>LXD provides the agent through a remote <code class="docutils literal notranslate"><span class="pre">9p</span></code> file system and a <code class="docutils literal notranslate"><span class="pre">virtiofs</span></code> one that are both available under the mount name <code class="docutils literal notranslate"><span class="pre">config</span></code>.
To install the agent, you’ll need to get access to the virtual machine and run the following commands as root:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>modprobe 9pnet_virtio
mount -t 9p config /mnt -o access=0,transport=virtio || mount -t virtiofs config /mnt
cd /mnt
./install.sh
cd /
umount /mnt
reboot
</pre></div>
</div>
<p>You need to perform this task once.</p>
</section>
<section id="create-a-windows-vm">
<h3>Create a Windows VM<a class="headerlink" href="#create-a-windows-vm" title="Link to this heading">¶</a></h3>
<p>To create a Windows VM, you must first prepare a Windows image.
See <a class="reference internal" href="../images_create/#images-repack-windows"><span class="std std-ref">Repack a Windows image</span></a>.</p>
<p>The <a class="reference external" href="https://ubuntu.com/tutorials/how-to-install-a-windows-11-vm-using-lxd">How to install a Windows 11 VM using LXD</a> tutorial shows how to prepare the image and create a Windows VM from it.</p>
</section>
</section>
</section>
</article>
</div>
<footer>
<div class="related-pages">
<a class="next-page" href="../instances_configure/">
<div class="page-info">
<div class="context">
<span>Next</span>
</div>
<div class="title">How to configure instances</div>
</div>
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
</a>
<a class="prev-page" href="../../instances/">
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
<div class="page-info">
<div class="context">
<span>Previous</span>
</div>
<div class="title">Instances</div>
</div>
</a>
</div>
<div class="bottom-of-page">
<div class="left-details">
<div class="copyright">
© 2014-2026 AGPL-3.0, LXD contributors
</div><div class="last-updated">
Last updated on Jun 06, 2025</div>
</div>
<div class="right-details">
<a href="" class="js-revoke-cookie-manager muted-link">Manage your tracker settings</a>
</div>
</footer>
</div>
<aside class="toc-drawer">
<div class="toc-sticky toc-scroll">
<div class="toc-title-container">
<span class="toc-title">
Contents
</span>
</div>
<div class="toc-tree-container">
<div class="toc-tree">
<ul>
<li><a class="reference internal" href="#">How to create instances</a><ul>
<li><a class="reference internal" href="#examples">Examples</a><ul>
<li><a class="reference internal" href="#create-a-container">Create a container</a></li>
<li><a class="reference internal" href="#create-a-virtual-machine">Create a virtual machine</a></li>
<li><a class="reference internal" href="#create-a-container-with-specific-configuration-options">Create a container with specific configuration options</a></li>
<li><a class="reference internal" href="#create-a-vm-on-a-specific-cluster-member">Create a VM on a specific cluster member</a></li>
<li><a class="reference internal" href="#create-a-container-with-a-specific-instance-type">Create a container with a specific instance type</a></li>
<li><a class="reference internal" href="#create-a-vm-that-boots-from-an-iso">Create a VM that boots from an ISO</a></li>
<li><a class="reference internal" href="#install-the-lxd-agent-into-virtual-machine-instances">Install the LXD agent into virtual machine instances</a></li>
<li><a class="reference internal" href="#create-a-windows-vm">Create a Windows VM</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</aside>
</div>
</div><script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=a5603611"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/scripts/furo.js?v=46bd48cc"></script>
<script src="../../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../../_static/copybutton.js?v=b01cb6f2"></script>
<script src="../../_static/config-options.js"></script>
<script src="../../_static/design-tabs.js?v=f930bc37"></script>
<script src="../../_static/tabs.js?v=3030b3cb"></script>
<script src="../../_static/js/bundle.js?v=a4d88309"></script>
<script src="../../_static/header-nav.js?v=e117ad08"></script>
<script src="../../_static/github_issue_links.js?v=32bb732f"></script>
<script>
const github_url = "https://github.com/canonical/lxd";
</script>
</body>
</html>