I’ve been running an LXD container on host1 using an lxdbr0 default bridge and a proxy. I would now like to transfer this container to a new machine (host2) which has a NIC-bound br0 bridge so that the container will now appear as a host directly attached to the local network along with some other containers already in place. I transferred the container as follows:
host1$ lxc stop atom
host1$ lxc export atom atom_2023-04-23.tar.gz
- copy atom_2023-04-23.tar.gz to host2
host2$ lxc import atom_2023-04-23.tar.gz atom
On host1 the container just used the default profile. The default profile on host2 is configured with the br0 bridge. I assumed the import would succeed and that I’d have to fiddle with the profile to get the networking and IP address sorted out, but unfortunately the import failed completely:
archives@www2:~$ lxc import ./atom_2023-05-24_export.tar.gz atom
Error: Failed importing backup: Failed creating instance record:
Failed initialising instance: Invalid devices: Device validation failed for "eth0":
Failed loading device "eth0": Failed to load network "lxdbr0" for project "default":
Network not found
The documentation on importing/exporting containers is very sparse, so I’m not sure of the best way to proceed. host1 does not have a NIC-bound br0 bridge, so it’s not possible for me to re-engineer the networking on host1 before transferring the container to host2. Presumably I could create a default profile on host2 matching the default profile on host1, import the container and then update the profile after import, but that seems awfully kludgy – surely there’s a better way to do this.