{"id":2852,"date":"2022-05-11T01:54:00","date_gmt":"2022-05-11T01:54:00","guid":{"rendered":"https:\/\/dft.wiki\/?p=2852"},"modified":"2026-07-11T15:21:49","modified_gmt":"2026-07-11T19:21:49","slug":"managing-containers-with-lxd-cheat-sheet","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=2852","title":{"rendered":"Managing System Containers &#8211; Cheat Sheet"},"content":{"rendered":"<p><span data-preserver-spaces=\"true\"><strong>Linux Containers<\/strong> (LXC) are typically managed by <strong>LXD<\/strong> or <strong>Incus<\/strong> as if they were Virtual Machines, allowing them to take <\/span><strong><span data-preserver-spaces=\"true\">snapshots<\/span><\/strong><span data-preserver-spaces=\"true\">, have <\/span><strong><span data-preserver-spaces=\"true\">distinct IPs<\/span><\/strong><span data-preserver-spaces=\"true\">, and <\/span><strong><span data-preserver-spaces=\"true\">retain data when shut down<\/span><\/strong><span data-preserver-spaces=\"true\">.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">Containers can be managed using profiles to define network settings and other configuration parameters, such as limiting the maximum CPU or RAM usage per instance.<\/span><\/p>\n<p>It is worth mentioning that since <span style=\"text-decoration: underline;\">Canonical took full control of the LXD project<\/span>, the community created a fork called <strong>Incus<\/strong> [<a href=\"https:\/\/github.com\/lxc\/incus\">Link<\/a>]. This fork has removed many of Canonical&#8217;s ecosystem-specific components and became the officially adopted option of <strong>LinuxContainers.org<\/strong> [<a href=\"https:\/\/linuxcontainers.org\/incus\/\">Link<\/a>]. So, the content of this post might interchangeably use or mention LXD or Incus as if they were synonyms, although they slightly differ for basic operations&#8230;<\/p>\n<p><span data-preserver-spaces=\"true\">Internally, containers can communicate using <\/span><strong><span data-preserver-spaces=\"true\">containerName.lxd<\/span><\/strong><span data-preserver-spaces=\"true\"> because a DNS service is configured by default.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">LXD vs Docker<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">LXD is a system container that runs a full operating system, while Docker is an application container that typically runs a single application and abstracts storage, networking, and logs from the user.<\/span><\/p>\n<hr \/>\n<p><strong>INSTALLATION<\/strong><\/p>\n<p><strong>Incus <\/strong>(recommended)<\/p>\n<pre>sudo apt update\r\nsudo apt install incus -y\r\nsudo usermod -aG incus-admin $USER\r\nincus admin init<\/pre>\n<p>If you want to run virtual machines too and not just containers:<\/p>\n<pre>sudo apt install qemu-system -y<\/pre>\n<p>If you are planning to migrate from LXD:<\/p>\n<pre>sudo apt install incus-tools -y<\/pre>\n<p><strong>LXD<\/strong><\/p>\n<p>The second command (optional) enables the Web UI.<\/p>\n<pre>sudo snap install lxd -y\r\nsudo snap set lxd ui.enable=true\r\nsudo systemctl reload snap.lxd.daemon.service\r\nsudo usermod -aG lxd $USER\r\nsudo lxd init<\/pre>\n<p><strong><span data-preserver-spaces=\"true\">Note:<\/span><\/strong><span data-preserver-spaces=\"true\"> Adding your user to the lxd group is optional but recommended, as it allows managing containers without using sudo each time. A logout and login may be required for the group change to take effect.<\/span><\/p>\n<p><strong>WEB UI SETUP<\/strong><\/p>\n<p>The Web UI is only available from <strong>LXD 5.14<\/strong> or newer. Navigate to <strong>https:\/\/127.0.0.1:8443\/<\/strong> from the local machine, or use the network address if connecting remotely:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3863 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-01-1024x643.png\" alt=\"\" width=\"640\" height=\"402\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-01-1024x643.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-01-300x188.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-01-768x482.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-01.png 1353w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3862 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-05-1024x643.png\" alt=\"\" width=\"640\" height=\"402\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-05-1024x643.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-05-300x188.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-05-768x482.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-05.png 1353w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3861 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-36-1024x643.png\" alt=\"\" width=\"640\" height=\"402\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-36-1024x643.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-36-300x188.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-36-768x482.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-48-36.png 1353w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3860 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-49-28-1024x643.png\" alt=\"\" width=\"640\" height=\"402\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-49-28-1024x643.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-49-28-300x188.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-49-28-768x482.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-49-28.png 1353w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3859 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-05-1024x308.png\" alt=\"\" width=\"640\" height=\"193\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-05-1024x308.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-05-300x90.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-05-768x231.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-05.png 1353w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3858 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-35-1024x326.png\" alt=\"\" width=\"640\" height=\"204\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-35-1024x326.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-35-300x96.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-35-768x245.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-35.png 1353w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3857 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-45-1024x643.png\" alt=\"\" width=\"640\" height=\"402\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-45-1024x643.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-45-300x188.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-45-768x482.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-50-45.png 1353w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3856 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-53-1024x689.png\" alt=\"\" width=\"640\" height=\"431\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-53-1024x689.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-53-300x202.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-53-768x517.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-53.png 1192w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3855 size-large\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-59-1024x689.png\" alt=\"\" width=\"640\" height=\"431\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-59-1024x689.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-59-300x202.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-59-768x517.png 768w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2022\/05\/Screenshot-from-2024-01-04-12-53-59.png 1192w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Completed!<\/p>\n<hr \/>\n<p><strong>MOST POPULAR COMMANDS<\/strong><\/p>\n<p><code>lxc<\/code> and <code>incus<\/code> can pretty much do the same thing the same way in the examples below.<\/p>\n<ul>\n<li>lxc help\n<ul>\n<li>Shows the list of available commands.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>remote list<\/strong>\n<ul>\n<li>Shows the list of remote repositories.<\/li>\n<\/ul>\n<\/li>\n<li>lxc image list <strong>ubuntu:<\/strong>\n<ul>\n<li>Lists available images of Ubuntu.<\/li>\n<\/ul>\n<\/li>\n<li>lxc image list <strong>images:<\/strong> ubuntu jellyfish\n<ul>\n<li>Lists <strong>all<\/strong> officially supported images matching the names ubuntu and jellyfish.<\/li>\n<\/ul>\n<\/li>\n<li>lxc image <strong>alias<\/strong> list images:\n<ul>\n<li>Lists images in a more user-friendly format.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>launch<\/strong> ubuntu:26.04 u26lts\n<ul>\n<li>Launches a container named u26lts (downloads the image first if not available locally).<\/li>\n<\/ul>\n<\/li>\n<li>lxc launch ubuntu:26.04 u26lts <strong>&#8211;vm<\/strong>\n<ul>\n<li>Launches a virtual machine.<\/li>\n<\/ul>\n<\/li>\n<li>lxc launch images: ubuntu\/26.04 u26lts <strong>-c limits.cpu=1 -c limits.memory=256MiB<\/strong>\n<ul>\n<li>Launches a container with limits on maximum CPU and RAM usage.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>list<\/strong>\n<ul>\n<li>Lists existing containers.<\/li>\n<\/ul>\n<\/li>\n<li>lxc list <strong>&#8211;columns &#8220;ns4S&#8221;<\/strong>\n<ul>\n<li>Lists containers in a table with columns: name, status, IPv4, and number of snapshots.\n<ul>\n<li>4 &#8211; IPv4 address<\/li>\n<li>6 &#8211; IPv6 address<\/li>\n<li>a &#8211; Architecture<\/li>\n<li>c &#8211; Creation date<\/li>\n<li>n &#8211; Name<\/li>\n<li>p &#8211; PID of the container&#8217;s init process<\/li>\n<li>P &#8211; Profiles<\/li>\n<li>s &#8211; State<\/li>\n<li>S &#8211; Number of snapshots<\/li>\n<li>t &#8211; Type (persistent or ephemeral)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>lxc list <strong>security.privileged=true<\/strong>\n<ul>\n<li>Lists containers filtered by a property.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>exec<\/strong> u26lts <strong>&#8212;<\/strong> <strong>apt update &amp;&amp; apt upgrade -y &amp;&amp; apt install nginx -y<\/strong>\n<ul>\n<li>Executes a command inside a container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>exec<\/strong> u26lts <strong>&#8211;env KEY=VALUE script.sh<\/strong>\n<ul>\n<li>Executes a script inside the container with an environment variable.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>exec<\/strong> u26lts <strong>bash<\/strong>\n<ul>\n<li>Opens a Bash shell inside the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>file edit<\/strong> u26lts\/<strong>etc\/passwd<\/strong>\n<ul>\n<li>Edits a file inside the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>stop<\/strong> u26lts\n<ul>\n<li>Stops the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>start<\/strong> u26lts\n<ul>\n<li>Starts the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>restart &#8211;force<\/strong> u26lts\n<ul>\n<li>Force-restarts the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>snapshot<\/strong> u26lts snapshot01\n<ul>\n<li>Creates a snapshot of the container named snapshot01.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>restore<\/strong> u26lts snapshot01\n<ul>\n<li>Restores the container from a snapshot.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>delete<\/strong> u26lts\/snapshot01\n<ul>\n<li>Deletes a snapshot.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>config set<\/strong> u26lts <strong>boot.autostart 1<\/strong>\n<ul>\n<li>Configures the container to start automatically when the host boots.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>config set<\/strong> u26lts <strong>boot.autostart.delay 60<\/strong>\n<ul>\n<li>Sets the number of seconds to wait after boot before starting the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>config set<\/strong> u26lts <strong>boot.autostart.order 3<\/strong>\n<ul>\n<li>Sets the startup order for auto-starting containers.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>config set<\/strong> u26lts <strong>limits.memory 1GB<\/strong>\n<ul>\n<li>Sets the maximum RAM the container can use, applied on the fly without stopping it.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>config edit<\/strong> u26lts\n<ul>\n<li>Opens the container&#8217;s configuration file in an editor.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>info<\/strong> u26lts\n<ul>\n<li>Shows information about the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>config show &#8211;expanded<\/strong> u26lts\n<ul>\n<li>Shows the full expanded configuration applied to the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>delete<\/strong> u26lts\n<ul>\n<li>Deletes the container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>copy<\/strong> u26lts u26lts-copy\n<ul>\n<li>Clones the container and assigns a name to the new one.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>copy u26lts\/snapshot01<\/strong> u26lts-from-snapshot01\n<ul>\n<li>Clones the container from a snapshot and assigns it a name.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>move<\/strong> u26lts u26lts-renamed\n<ul>\n<li>Renames a local container or moves it to another host.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>move u26lts\/snapshot01<\/strong> u26lts\/snapshot01-renamed\n<ul>\n<li>Renames a snapshot of a local container.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>file push<\/strong> fileName.zip u26lts\/<strong>root\/<\/strong>\n<ul>\n<li>Pushes a file from the host to the container&#8217;s root filesystem.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>file pull<\/strong> u26lts\/<strong>root\/<\/strong>fileName.zip .\n<ul>\n<li>Pulls a file from the container&#8217;s root filesystem to the host.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>file pull<\/strong> u20lts\/root\/etc\/hosts<strong> &#8211; | less<\/strong>\n<ul>\n<li>Pulls a file from the container and pipes it into a consecutive command.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>profile list<\/strong>\n<ul>\n<li>Lists existing profiles.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>profile show default<\/strong>\n<ul>\n<li>Shows the configuration of the default profile.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>delete &#8211;force<\/strong> u26lts\n<ul>\n<li>Force-deletes the container without stopping it first.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>network list<\/strong>\n<ul>\n<li>Lists the host&#8217;s network adapters.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>network show<\/strong> lxdbr0\n<ul>\n<li>Shows details of a network interface.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>network create<\/strong> myNetworkName <strong>&#8211;type=physical<\/strong> <strong>parent=<\/strong>br0 <strong>&#8211;target=u26lts<\/strong>\n<ul>\n<li>Attaches a physical network to a container.<\/li>\n<li>Other supported network types: bridge, ovn, macvlan, and sriov.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>network set<\/strong> myNetworkName <strong>dns.nameservers=<\/strong>8.8.8.8\n<ul>\n<li>Configures the network to use a specific DNS server.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>network forward port add<\/strong> myNetworkName 192.168.1.2 tcp 80,8080-8088 10.1.1.2 80,8080-8088\n<ul>\n<li>Forwards ports from an external IP to an internal IP.<\/li>\n<li>Supports TCP and UDP, with single ports, port lists, or port ranges.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>storage list<\/strong>\n<ul>\n<li>Lists storage pools.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>storage create<\/strong> myStorage <strong>btrfs<\/strong>\n<ul>\n<li>Creates a storage pool. btrfs is recommended for running Docker inside LXD, as it best supports the layering Docker requires.<\/li>\n<li>Other supported types: dir, ceph, cephfs, lvm, and zfs.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>launch<\/strong> images:ubuntu\/26.04 myContainer\n<ul>\n<li>Creates a container from the Ubuntu 26.04 image.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>storage volume create<\/strong> myStorage myVolume\n<ul>\n<li>Creates a volume inside a storage pool.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>storage volume list<\/strong> myStorage\n<ul>\n<li>Lists volumes inside a storage pool.<\/li>\n<\/ul>\n<\/li>\n<li>lxc <strong>config set myContainer security.nesting=true security.syscalls.intercept.setxattr=true security.syscalls.intercept.mknod=true<\/strong>\n<ul>\n<li>Enables the settings required to run Docker inside the container. A restart is required.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<p><strong>BONUS<\/strong><\/p>\n<p>Proxy port <strong>2222<\/strong> on all host interfaces to port <strong>22<\/strong> of the container:<\/p>\n<pre>incus config device add <strong>u26lts<\/strong> ssh proxy listen=tcp:0.0.0.0:<strong>2222<\/strong> connect=tcp:127.0.0.1:<strong>22\r\n<\/strong>incus config show <strong>u26lts<\/strong> --expanded\r\n<\/pre>\n<p>Create a bridge to a physical NIC for the container:<\/p>\n<pre>incus network create <strong>br0<\/strong> bridge.external_interfaces=<strong>enp3s0\r\n<\/strong>incus config device add <strong>u26lts<\/strong> eth0 nic network=<strong>br0<\/strong><\/pre>\n<p>Check out Bootable Containers, also known as <strong>BootC<\/strong> [<a href=\"https:\/\/github.com\/containers\/bootc\">Link<\/a>]. Interestingly, this new type of container includes a kernel and drivers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux Containers (LXC) are typically managed by LXD or Incus as if they were Virtual [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2852","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/2852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2852"}],"version-history":[{"count":17,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/2852\/revisions"}],"predecessor-version":[{"id":2857,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/2852\/revisions\/2857"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}