Home Backup/Copy LXD container to another host
Post
Cancel

Backup/Copy LXD container to another host

The why?

Although I run LXD in clusters, my clusters are generally low powered that don’t need much compute.

So i do run some services that require compute, on my laptop or desktop in LXD, and here I will show a simple way to copy over the LXD container to another host.

First you need to remote add and get a token, so in this example, lets assume my laptop is running a container and I want that container backed up.

On my laptop…

I will generate a token.

1
lxc config trust add

On my desktop…

I need to add my laptop..

1
lxc remote add laptop

When you paste in the token, no text will be displayed in the terminal, so don’t be alarmed. Just paste it in when prompted and press enter. Now remote switch to the laptop from the desktop.

1
lxc remote switch laptop

And now Copy the container over from the desktop…

1
lxc copy container-name local:container-name-backup --verbose

You can then change back your remote to local on the desktop if you with…

1
lxc remote switch local

Hopefully helps someone… it’ll help remind me in future… my memory needs help sometimes…

This post is licensed under CC BY 4.0 by the author.