To update an LXD container running Ubuntu 16.04 to 18.04, you can use the lxc
command-line tool. Here are the general steps to follow:
- Start by making a snapshot of the container, so that you can roll back if anything goes wrong during the update process:
lxc snapshot <container name> <snapshot name>
- Then update the container’s package list and upgrade the packages to the latest version:
lxc exec <container name> -- apt-get update
lxc exec <container name> -- apt-get dist-upgrade
- After upgrading the packages, reboot the container:
lxc exec <container name> -- reboot
- After the container has rebooted, check the version of Ubuntu:
lxc exec <container name> -- lsb_release -a
- if the version is still 16.04 then you have to change container’s image to 18.04. To do this, stop the container:
lxc stop <container name>
- Then remove the container:
lxc delete <container name>
- And finally, create a new container using the 18.04 image:
lxc launch ubuntu:18.04 <container name>
- Finally, you can restore the container’s data from the snapshot you created earlier:
lxc restore <container name> <snapshot name>
Note: These are just general steps, for more detailed and accurate steps please refer to the official documentation of LXD and Ubuntu.
(Tramadol)