I've installed lxd on two ubuntu hosts that can only communicate via an intermediate server (on which I don't have su privileges). I've created a container on my localhost and now wish to load the container on the remote server.
I consulted the basic.sh test script in the lxc/lxd repo to confirm that I'm using the correct approach (I discovered along the way that I was misunderstanding images vs containers).
I've created a container test on my localhost, installed all the necessary goodies within it, stopped it, published it, and executed the following commands:
lxc image export test
This gives me a tarball 42cf01c53cb9e...83e3c48.tar.gz (shortened here), as described in the documentation (I'm running lxc and lxd versions 2.0.0.beta3). Attempting to import that image on the same host via
lxc image import 42cf01c53cb9e...83e3c48.tar.gz --alias testimage
yields the error:
exit status 2 (tar: metadata.yaml: Not found in archive)
The basic.sh script leads me to believe that I was following the correct route though (except for the tar.gz vs tar.xz descrepancY). I'm able to export standard images and obtain an .xz file (when I obtain them using lxd-images). For example,
lxd-images import ubuntu --alias ubuntu
lxc image export ubuntu
produces a meta-ubuntu...tar.xz and ubuntu...tar.xz file, which can be imported (on a different server) with
lxc image import meta...tar.xz rootfs ubuntu...tar.xz --alias imported_ubuntu
How do I copy containers between hosts?
Thanks!
Edit: I've investigated further and have published my test container, which creates an image of it. Then I get the .gz file though (without the meta-data) when I export it. If I hijack metadata from the original image, then I can't get the container started although import no longer crashes on me --- I obviously don't know what I'm doing. Pulling the image over to a second host using lxd's remote: approach (after adding the host using the lxd config) does not result in it appearing in lxc images list.