Search code examples
containerslxclxd

Missing Network function on LXD?


I am trying to configure the networking options for my lxd container but when I try the following command:

lxc network create testbr0

I get the following result:

root@Server02:/var/lib# lxc network create testbr0
Usage: lxc [options]

Checking the list of available commands, I dont see network as an option

Here are the available commands I see:

config, copy, delete, exec, file, finger, image, info, init, launch, list, monitor, move, pause, profile, publish, remote, restart, restore, snapshot, start, stop, version

I'm using Ubuntu 14.04

Any insights?

Thanks


Solution

  • I assume you are using lxd Version 2.0.11. There is no network command in this version.

    If you want to use the network command you have to install lxd feature releases (LXD 2.x).

    On Ubuntu 14.04 there is no ppa containing the lxd feature releases, so you have to install snap and use the snap package:

    sudo apt update
    
    # check if snap is installed, install it if not
    if ! type snapctl >/dev/null; then sudo apt install -y snapd; fi
    
    # install lxd
    sudo snap install lxd
    
    # wait for lxd startup
    while ! echo -e "GET / HTTP/1.0\r\n" | sudo nc -U /var/snap/lxd/common/lxd/unix.socket > /dev/null; do sleep 1; done
    
    # migrate from ppa to snap lxd
    sudo /snap/bin/lxd.migrate
    
    # 14.04 does not add the user to lxd group so we do it explicitly
    sudo adduser $(id -un) lxd