Is it possible to export a lxc container to another machine? There are some tools like lxc-snap and 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?

Edit: I ended chrooting into the /var/lib/lxc/centos folder and getting things done as that was sufficient for my use case. However make sure that you chroot according to the host system architecture i.e use linux32 chroot if the host is a 64 bit machine but your installation is 32 bit.

4

2 Answers

Did you try:

Turning a container into an image The easiest way by far to build an image with LXD is to just turn a container into an image. This can be done with: lxc launch ubuntu:14.04 my-container lxc exec my-container bash <do whatever change you want> lxc publish my-container --alias my-new-image You can even turn a past container snapshot into a new image: lxc publish my-container/some-snapshot --alias some-image 

From

1

the default container location is: /var/lib/lxc/cn_name

You can lxc-stop the container then copy the cn_name contents to the same location in the new machine using typical tools such as scp, rsync etc.

You can tar up the entire cn_name directory also then untar on the new machine in the same directory

Just remember whatever you do ... preserver owner etc attributes for files & directories you copy so they are still runnable on the new system.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.