I’d like to use the API to effectively run the equivalent of lxc launch <remote>:<image> <hostname> for launching containers/VMs on an LXD server called mylxdserver.example.com. I am passing the following source configuration (as part of my larger config):
The image server, myimageserver.example:8443, is also a server running LXD but it just hosts images I push to it (no local containers/VMs) with the following config:
Moreover, I have added myimageserver.example.com:8443 as a remote on mylxdserver.example.com. I can successfully launch instances with client.instances.create from images on myimageserver.example.com:8443 but only if the image was published with --public. However, I do not want to publish all my images as public. How can I use the API to launch new containers/VMs with non-public images? This can easily be done with lxc launch so it seems like it should be possible with the API too, but I can’t seem to get it to work.
I’ve tried using both the latest version of LXD as well as 5.0 stable.
Have you tried running the lxc launch command with --debug to see which API calls it uses?
Maybe this can help track down what you’re missing in your calls.
Thanks, this helped. I was able to see that it was calling /1.0/images/<fingerprint>/secret to get the secret and then including that in the config when creating the instance: