LXD configuration notes

Update snap to latest version

sudo snap refresh lxd --channel=latest

Autostart

lxc config set <container> boot.autostart 1

Disable firewall

By editing network bridge

config
  ipv4.firewall: "false"
  ipv6.address: none

or by calling

lxc network set lxdbr0 ipv4.firewall false
lxc network set lxdbr0 ipv6.firewall false

Fixed ip

lxc stop <container>
lxc network attach lxdbr0 <container> eth0 eth0
lxc config device set <container> eth0 ipv4.address 192.168.45.45
lxc start <container>

Add mountpoint from host

lxc config device add <container> <new-device-name> disk source=<path> path=<path>

Enabling domain

Edit the network with

lxc network edit lxdbr0

then make config look like this:

config:
  dns.domain: lxd.40.lan

Enable nested containers

lxc config set <container> security.nesting true

Listing images on images: remote

list all images

lxc image list images:

filter images only for certain distros

lxc image list images: 'alpine'
lxc image list images: 'opensuse'

changed formats

lxc image list images: --columns lfast --format csv

formats

  • csv
  • json
  • table
  • yaml
  • compact

columns:

  • l - Shortest image alias (and optionally number of other aliases)
  • L - Newline-separated list of all image aliases
  • f - Fingerprint (short)
  • F - Fingerprint (long)
  • p - Whether image is public
  • d - Description
  • a - Architecture
  • s - Size
  • u - Upload date
  • t - Type