0dbb1ed83f37aba5b091d2275d13c60e25e0d85b
lxc
Setup
requires snap
sudo apt install snap
sudo snap install lxd
sudo usermod -a -G lxd $(whoami)
Init
Setup lxd
sudo lxd init
Containers
List
lxc list
Get Info
lxc info containername
Create
lxc launch ubuntu containername
move
lxc mv ubuntu ubuntu1
lxc mv ubuntu1 -s=poolname
Stop
lxc stop containername
Exec bash on container
lxc exec $containername bash
Exec multiple commands
lxc exec "container name" -- bash -c "apt update -y && apt upgrade -y"
delete a container
lxc rm "container name"
#if force required
lxc rm "container name" --force
Configuration
Edit
lxc config edit "container name"
Set value
#Example
lxc config set "container name" "security.nesting" "true"
Profile Management
lxc profile remove "container name" "profile name to remote"
lxc profile assign "container name" "profile name to assign"
Profiles
macvlan only
- create copy from default
lxc profile copy default eth0_macvlan
lxc profile edit eth0_macvlan
- edit new profile
devices:
eth0:
nictype: macvlan
parent: eth0 # parent ethernet name
type: nic
Description
Languages
Shell
100%