sudo apt-get install lxc
sudo systemctl status lxc
sudo snap install lx
sudo apt install lxd lxd-client
sudo systemctl start lxd
sudo systemctl status lxd
After sudo lxd init
,
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
Would you like LXD to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Clustering means multiple computer server. Local network bridge allows the containers to communicate with the original computer. All of them are default. Storage backend to dir. Stale cached images updated automatically ensure the remote repo updates your local images whenever there are changes.
The followings are for understanding your system,
sudo lxc help # find the command
sudo lxc version # just print version == 3
sudo lxc storage list # where to store lxc
sudo lxc info a
lxc config show a
lxc profile list
lxc profile show default
sudo lxc remote list # which repo to install lxc
sudo lxc image list # what is downloaded
sudo lxc image list images: # list all images that can be downloaded
sudo lxc image list images:ubuntu
sudo lxc image list # list all running containers
uname -r # 5.4.0-66-generic host kernel
lsb_release -dirc # show version
free -m # show ram
ip a s # show all connections like inet
nproc # number of processors
hostname # yui@yui-Inspiron-7590 will show yui-Inspiron-7590
ping lxname.lxd
lxc launch ubuntu:16.04
root:100000:65536
to /etc/subuid
and /etc/subgid
, then reboot.ip a s
or ifconfig
can show the new network bridge.
lxc stop prepared-snipe # also have start option
lxc delete prepared-snipe # --force without stopping
lxc copy a b
lxc start b
lxc stop a
lxc move a c
lxc start c
lxc exec a bash # login as a root user
exit
to get out.
lxc config set a limits.memory 512MB # or 1GB , check out by free -m
OR in profile
lxc profile edit profilename # config: limits.memory: 512MB
lxc launch ubuntu:16.04 env2 --profile profilename
lxc file push filename containername/root/
lxc file pull containername/root/filename .
lxc snapshot a backupname
lxc restore a backupname