Overlayfs on LXD


I intend to set up an overlay container for testing purpose.
Base container is setup with the name “base-lxd” with all the packages installed

Overlay container with the name “testoverlay” which is an empty image that has these 3 directories:
rootfs, overlay-work, overlay-upper

Before starting “testoverlay”, it is overlay mounted with this command:

mount -t overlay -o lowerdir=/var/lib/lxd/containers/base-lxd/rootfs,upperdir=/var/lib/lxd/containers/testoverlay/overlay-upper,workdir=/var/lib/lxd/containers/testoverlay/overlay-work overlay /var/lib/lxd/containers/testoverlay/rootfs

When I start, it remaps /var/lib/lxd/containers/testoverlay/rootfs files from 1000000:1000000 to 2000000:2000000 which probably result failure to start this overlaid container. The mount point is also somehow unmount.

Or is there a way to tell lxc start not to perform any further remapping if it has already been remapped?

Any ideas, anyone? Thanks.

You would need to manually set/alter the volatile config keys for the container, basic that off the source container.

I have tried to alter the volatile keys on the overlaid container side such that the id mapping doesn’t change when it is started. However, it still failed due to this error message:
Error: Common start logic: Extended attributes changed during retrieval

No log when execute lxc info --show-log testoverlay