Is there a way to create and launch a LXD container using a local image rather than requiring an internet connection? All the documentation and how-tos I've been able to find are based on having an internet connection and pulling an image from some remote store.

I would like to be able to put a compatible image on my local filesystem and then build containers from that without having to have any external internet connectivity at all.

  • link I will admit, I hadn't looked at this in a while, it seems that has changed and this may well be exactly the very simple answer I was looking for. – bladernr Jan 24 '17 at 19:07
  • It is covered in detail here - linuxcontainers.org/lxd/getting-started-cli , specifically lxc image import \<file\> --alias my-alias under the "Manually importing an image" section. – Panther Jan 24 '17 at 19:17
  • @bodhi.zazen thanks, I think that may be what I was looking for. trying it out now. – bladernr Jan 24 '17 at 19:23

Thanks for pointing me in the right direction @bodhi.zazen.

Indeed, it is covered at getting-started-cli but the other clue was further in at github

So the answer is in the following steps:

wget http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-root.tar.xz
wget http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-lxd.tar.xz
lxc image import xenial-server-cloudimg-amd64-lxd.tar.xz rootfs xenial-server-cloudimg-amd64-root.tar.xz --alias SomeAlias
lxc launch SomeAlias MyMachine

That gets me to the point where I can create a local image store and either import the images from a local server or copy them to the node and import them directly from the node's filesystem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.