LXC commands
- initialize lxd with minimal config:
lxd init --minimal
- list all ubuntu images available:
lxc image list ubuntu:
- create a macvlan network to allow vlan and dhcp usage:
lxc network create uplink.vlan2 --type=macvlan parent=<int-name> vlan=20
- launch a container and attach to vlan 20:
lxc launch ubuntu:22.04 <contianer-name> -n uplink.vlan2
- config commands:
- show config:
lxc config show <container-name>
- unset a config value:
lxc config device unset <container-name> eth name
- remove a device/config:
lxc config device remove <container-name> eth0 network
- add a device/config:
lxc config add <container-name> eth0 nic nictype=bridged parent=uplink name=eth0
- stop/restart/delete an instance:
lxc stop|restart|delete <container-name>
- show other distro images:
lxc image list images:<distro-name> i.e. lxc image list images:nixos
- launch other distro image:
lxc launch images:nixos/24.05
- change password for default ubuntu user:
lxc exec <container-name> -- passwd <username> i.e. lxc exec test-container -- passwd ubuntu
- set lxc ui on all available ips rather than default localhost:
lxc config set core.https_address :8443
- set lxc ui on specific ip:
lxc config set core.https_address <your-ip>:8443