Shell script to update all lxd container hypervisor

in Categories Automation & Management, Virtualization last updated September 5, 2016

A simple shell script wrapper to update all lxd container hypervisor images eitehr running Debian or Ubuntu Linux.

Run script as follows:
$ /path/to/update.lxd.vms
Sample outputs:

Share this on:

5 comment

  1. Better and automated approach would be to install and configure unattended-upgrades on the containers

    1. You can just call this script from a host with cron and all containers will get updated:

  2. Thank you for publishing this, very helpful. For those of us learning bash scripts, could you break down this line? I think I understand what it does, but having the explanation would be great.
    clist="$(${_lxc} list -c ns | ${_awk} '!/NAME/{ if ( $4 == "RUNNING" ) print $2}')"

    1. 1. Find list of running container lxc with list -c ns
      2. Use awk to print a list of container which are running but exclude header NAME with awk command

    Have a question? Post it on our forum!