Making a container that was a chroot file system

(Phil Howard) #1

i have run a non-container chroot file system but now i want to make it be a full container. when i make these, i populate the file tree myself from an empty directory to ready to go. what tool is appropriate to make this into a container? which needs to be done first … populating it or making it into a container?

(Stéphane Graber) #2

A common way to do this is to create a tiny container using an image like busybox or alpine, then replace the rootfs with yours. If using LXD, an alternative is to make an image file and import that, but the rsync way still tends to be easier.

(Phil Howard) #3

the chroot trees i have are actually kind of large, being subsets of a full Ubuntu system (not busybox). that’s one reason i use rsync to refresh the working tree to initial state from my saved copy.

i’m planning to use lxd as it has a clean lxc command and will let me have managed containers when i am ready for that. i’m still accustomed to using chroot.