Hi I created 2 LXD containers for Ubuntu 18.04 and CentOS 7.5 and have some questions regarding managing snapshots and containers.
Questions
how to delete snapshots (not containers) ? i.e. delete csnapshot0 created below ?
how to re-create a container with a specific internal IP address if possible ? so if i deleted below container centos75, how would i go about recreating that container named centos75 with the same internal IP as previously used 10.71.164.168 ?
how to list snapshots ?
any way to dig detail into the details of what a snapshot contains ?
That’s the syntax to specify the snapshot usnap0 of the container ubuntu18.
Each container that you create, gets a random MAC address. That MAC address though stays permanent for the lifetime of the container.
The dnsmasq DHCP server of LXD will assign an IP address to each of those MAC addresses. Therefore, each container will practically keep the same IP address.
To get a container to receive a specific IP address, there are several options. You can set a static IP address (using the appropriate lxc command).
I think it’s not easy to get the difference between a snapshot and the base image.
Type lxc list --help to get the list of available difference outputs.
Most notably, you can switch to having CSV output which is friendlier to shell scripts.
Also, you can output to the JSON format that can be accessed with the jq command.
Note that when you lxc list mycontainername, lxc is using mycontainername as a filter.
Therefore, if you have two containers named mycontainername1 and mycontainername2, they will both show up in the output!
To force to show the exact name, try with lxc list ^mycontainername$. Those ^ and $ are special shell characters.
I just migrated using lxd.migrate from apt version of lxd 3.0.0 to snap lxd 3.1 and was wondering is there any effect on previous container made snapshots in terms of snapshot restores ? or do previous lxd version/repo apt vs snap made snaphots restore fine regardless ?
Should all be fine, lxd.migrate moves all your data over to the snap based storage and all LXD artifacts have always been backward compatible so restoring a snapshot made with LXD 2.0 on a LXD 3.1 server will work fine.