Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I export a lxc container?

Tags:

linux

lxc

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.

like image 518
Nishant Avatar asked Apr 28 '26 18:04

Nishant


1 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 https://insights.ubuntu.com/2016/04/01/lxd-2-0-image-management-512/

like image 168
xliiv Avatar answered Apr 30 '26 11:04

xliiv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!