SPDX-FileCopyrightText | SPDX-License-Identifier | title | author | footer | description | keywords | color | class | style | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
© 2023 Menacit AB <foss@menacit.se> |
CC-BY-SA-4.0 |
Virtualisation course: LXC/LXD demo |
Joel Rangsmo <joel@menacit.se> |
© Course authors (CC BY-SA 4.0) |
Demonstration of LXC/LXD for OS-level virtualisation |
|
#ffffff |
|
section.center {
text-align: center;
}
|
$ sudo snap install lxd
lxd 5.9-9879096 from Canonical✓ installed
$ sudo lxd init --minimal
$ sudo lxc image list images: | shuf
centos/8-Stream(3more)
openwrt/21.02(3more)
fedora/36(3more)
almalinux/9(3more)
opensuse/15.4/desktop-kde(1more)
mint/tina(3more)
alpine/3.17(3more)
[...]
$ sudo lxc launch images:almalinux/9 srv-1
Creating srv-1
Retrieving image: Unpack: 100% (3.81GB/s)
Starting srv-1
$ cat /etc/os-release | grep -F PRETTY_NAME
PRETTY_NAME="Ubuntu 22.04.1 LTS"
$ sudo lxc exec -t srv-1 -- /bin/bash
[root@srv-1 ~]# cat /etc/os-release | grep -F PRETTY_NAME
PRETTY_NAME="AlmaLinux 9.1 (Lime Lynx)"
$ sudo lxc info srv-1 --resources
Name: srv-1
Status: RUNNING
Resources:
Processes: 15
Disk usage:
root: 2.62MiB
Memory usage:
Memory (current): 54.58MiB
[...]
$ sudo lxc exec -t srv-2 -- /bin/ash
~ # apk add fortune
(1/3) Installing libmd (1.0.4-r0)
(3/3) Installing fortune (0.1-r1)
~ # fortune
Matter cannot be created or destroyed,
nor can it be returned without a receipt.
$ sudo lxc snapshot srv-2 pre_upgrade
$ sudo lxc restore srv-2 pre_upgrade
$ sudo lxc cluster list
node-1
node-2
node-3
$ sudo lxc info srv-1 | grep Location
Location: node-1
$ sudo lxc cluster evacuate node-1
$ sudo lxc info srv-1 | grep Location
Location: node-2
- Runs on a potato
- Automatic overlay networking
- LXD also supports HW-level virtualisation
- Live migration... sometimes
Recent drama in the development community has caused several contributors to leave the LXD project.
Checkout the community-driven fork called Incus.