Is there a way to upgrade an existing LXD image on the same system?

I had a container that I published and exported as an Image tarball.

Now I use that Image tarball to launch containers on several systems.

Recently I had to add some packages into my Image so I went back to the first container and then added packages to it and then re-published and exported it as a new Image tarball.

I then copied the new tarball to other system that had the older copy of the image. I tried importing the tarball with the same alias name thinking that it will update the existing image, but it generated the following error:

Error: Image with same fingerprint already exists

Is there a way to upgrade images? Or do I need to delete older images always to get the latest ones in use?

Because there could be a case where I have a container running with older image and I don’t want to delete that older container but rather upgrade the image so that the new containers can take advantage of the upgraded features in my image.

That error indicates that you’re trying to import an image which already exists.

Images are identified by the SHA256 of their content, so if you have the same fingerprint, you have the exact same image content.

1 Like

Ah I see. Yup it works with a different fingerprint and I am able to import the image even while it is in use by some other container.
Thanks @stgraber :slight_smile:

Also, just a quick thought if there could be a layer like method possible with LXD images. Just as in Docker. Because when I am downloading docker images I think it is able to use multi-threading with multiple layers getting downloaded/setup at the same time. While for LXD images I am right now pulling the entire tarball on a single thread.
Although if there’s a way to make it multi-threaded and quicken the download + import, then I’d be interested to learn about it.