Skip image unpacking on first launch after `lxc publish`?

Hello,

I have a container which (after set up) is used as a new image. For this I am using lxc publish my-container --alias my-new-image --compression none. Now when I try to launch a new container using the newly created image, the image still needs to be unpacked:

# lxc launch my-new-image test-container
Creating test-container
Retrieving image: Unpack: 17% (345.98MB/s) 

Is there any way that this unpacking can be when publishing the image? I tried to set --compression none, because I thought this would skip the need to again unpack the image, but this did not change anything.

Am I missing something or is this just not possible?

The lxc publish command’s job is to take an existing instance and convert it into a compressed image file. This necessarily means that to use that image it needs to be decompressed to be used.

However, depending on the storage pool type you are using, the image will only be unpacked once, for the first instance created, and subsequent instances created using that image will re-use the unpacked image volume.

See Images not syncing to a restored cluster member, image copy fails with Error: Failed remote image download: - #10 by tomp for more info.

Indeed that is the case, it’s only the first start of a container the case.
Thanks for your link, that explains why doing a publish uncompressed doesn’t have an effect on the first container start. I thought there would be a way to do this already in the publish step. Right now I am doing something like

lxc publish ...
lxc start new-image new-container
lxc stop new-container
lxc delete new-container

But I can live with that :slight_smile:

1 Like