Computer Tips - All commands from Getting Started with LXD video

Date: 2023may22 OS: Linux Language: bash Q. All commands from Getting Started with LXD video A. Here are all the commands from this useful video https://www.youtube.com/watch?v=aIwgPKkVj8s (Skipping first 8 minutes showing how to update your OS etc) Install snap in the way for your distro, eg for Fedora
dnf install snapd
List snap packages
snap list
Use snap to install lxd
snap install lxd
Add userself to group
usermod -aG lxd youruserid
Relogin
logout
List your groups groups Initialize lxd
lxd init filesystem = dir
List all local containers
lxc list
List all remote images
lxc image list images:
Search all remote images for "debian"
lxc image list images: debian
Search all remote images for "ubuntu" and "focal"
lxc image list images: ubuntu focal
Download and install ubuntu/focal names as ubuntu
lxc launch images:ubuntu/focal ubuntu
Run a command in a container - install apache2
lxc exec ubuntu -- apt install apache2
Visit its webpage
curl 10.155.2.72
Run a command in a container - ls /etc
lxc exec ubuntu -- ls /etc
Download and install debian/10 names as debian
lxc launch images:debian/10 debian
Run a command in a container - install apache2
lxc exec debian -- cat /etc/os-release
Stop container
lxc stop debian
Start container
lxc start debian
Restart container
lxc restart debian
To delete a container
lxc stop ubuntu lxc delete ubuntu
Take a snapshot
lxc snapshot debian mysnap1
Detailed info about a container
lxc info debian
Delete a snapshop
lxc delete debian/mysnap1
Restore a snapshop
lxc restore debian mysnap2
Make container start when host does
lxc config set debian boot.autostart 1
Restrict memory use
lxc config set debian limits.memory 1GB
List configuration
lxc config show debian
Wait 30 seconds before starting
lxc config set debian boot.autostart.delay 30
Set start order
lxc config set debian boot.autostart.order 8