Is it possible to export a
lxc container to another machine? There are some tools like
lxc-clone will those help in exporting to another system? Can I copy paste the rootfs folder or is there a standard way of doing this?
I do not think
lxc-snap are supposed to be used for moving containers to a new machine. The rationale for these commands, according to one of the LXC developers, is:
One of the obvious use cases of these snapshot clones is to support incremental development of rootfs images. Make some changes, snapshot, make some more changes, snapshot, revert…
There is no mention ever of an export to a different machine...
At the same time, I have successfully ported a Debian LXC from a Debian machine to an Arch Linux machine, by first creating a Debian LXC container, without any customization, then by copying over to the new machine the
config, fstab, lxcname.log files and the
rootfs directory. You may try it, like I did, but ... YMMV.
lxc containers on
btrfs volumes so I can snapshot them easily with
btrfs sub snap
These can be moved to a remote
btrfs filesystem more quickly than with
btrfs send /my/snapshot | ssh email@example.com "btrfs receive /my/destination"
btrfs is intelligent with snapshots & does not include virtual filesystems [
proc run sys]. Transfering incremental snapshots are also possible.
When moving snapshots to a non
- Mount the remote destination as an
cdto the mount
- Stop the container & create a
tar.xzarchive of the container
You can actually just copy the filesystem and make the relevant changes as mentioned in the above post to make everything work fine. Initially I did that and made it working.
I always have problems with NAT in LXC Containers, so if you are a light weight user, you can also just
chroot into the system. Currently I use
lxc-templates to create a copy of my desired OS and then
chroot into that system to do my stuff. I don't need a virtualization in my use case. The idea is just simple (not in terms of implementation) that it can be ported easily.