lxc

Written by Yujin Boby

Edit in WordPress

LXC is Linux Container, allows you to run lightweight virtual servers on your computer.

It is better use LXD instead of LXC. LXD provides a much easier-to-use interface to LXC.

To install lxc, run

apt install -y lxc

To create a VM, use

lxc-create -t download -n first-vm

To list VM, use the command lxc-ls

root@UNUSED:~# lxc-ls
first-vm 
root@UNUSED:~# lxc-ls -f
NAME     STATE   AUTOSTART GROUPS IPV4      IPV6 UNPRIVILEGED 
first-vm RUNNING 0         -      10.0.3.26 -    false        
root@UNUSED:~#

To start a VM, run

lxc-start VM_NAME

To login to a VM, run

lxc-attach VM_NAME

lxc config files

/etc/lxc/default.conf
/etc/lxc/lxc-usernet
/var/lib/lxc