Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Allow downloading and restoring backups of a container #2302
Comments
|
We may consider implementing something like this in LXD itself at some point, but it'd need careful thinking about how to do it in a way that works with all the different storage backends, especially when considering snapshots. |
stgraber
changed the title from
How to backup and restore container in tarball?
to
Allow downloading and restoring backups of a container
Aug 21, 2016
stgraber
added
Feature
Documentation
API
Maybe
labels
Aug 21, 2016
stgraber
added this to the later milestone
Aug 21, 2016
UPD: |
vistoyn
commented
Aug 23, 2016
•
|
I wrote this scripts to solve simple task: everydays backup containers to Amazon S3, and restore it if need. It can be done another way:
I can't found way how to update existing container from new image. I can't understand why doesn't exists comand to update container. Propose to remove the container and recreate it. #2303 What do you think, what is the easiest way to everydays backup containers to Amazon S3/Dropbox/other cloud storage and restore it if need? |
bungle
commented
Aug 24, 2016
•
|
Hi, I have also been looking answer for that. What I have and what I have not:
I'm looking for a right procedure to make a self containing backup of a LXD container that I can later on restore on another host in case that original host dies (with as little down-time as possible). I have read @vistoyn's script and others, but some concepts are still somewhat confusing to me. @vistoyn backups scripts aka backup container offline:
(repeat, say every day) Here are some other ways: Image:
Snapshot Offline:
Snapshot Online: (here we need to run say mysqldump in a container before making a snapshot in case of something corrupts with online snapshot?)
I kinda like the first one with Image as there you are basically just calling lxc commands. No need to figure out the right tar parameters etc. Maybe a one command that does that would be nice, eg. lxc export [remote:]<source container> [tarball]And other way to import:
That could go like this: lxc import <tarball> [remote:]<name>So backing up: # creates my-container.tar.gz on current directory (optionally on remote?)
lxc export my-containerAnd restoring on another host: # imports my-container.tar.gz image and launches my-container container
lxc import my-container.tar.gz my-containerAnd this procedure should probably take care of doing this by default or optionally (and have that info inside a package): # during export
lxc config show my-container > old-config
# during import
lxc config edit my-container < old-configWhat do you think? |
stgraber
modified the milestones:
later,
lxd-2.7
Nov 20, 2016
|
Closing this since we now have "lxd import" and serialized version of container config on the filesystem. So backing up your underlying storage is now sufficient to re-import the containers. |
vistoyn commentedAug 21, 2016
Sometimes need to backup and restore container in tarball.
For example i want make tarball of container and upload it on Amazon S3 as backup.
I can't find in official documentation simple way to do it.
I wrote bash scripts that do this.
https://github.com/vistoyn/lxd_backup
May be add this commands as official lxc commands?
Example like this:
or