Skip to main content

Volume Backup And Restoration Tool for Docker

Project description

vbart

GitHub PyPI PyPI - Status GitHub last commit GitHub issues PyPI - Downloads GitHub repo size PyPI - Python Version


Dinobox logo

Volume Backup And Restoration Tool for Docker

Why is backing up named docker volumes so hard? There's an extension for Docker Desktop, but I just want a simple, easy-to-use command line tool that allows me to backup and restore my named docker volumes. That's what vbart does.

With vbart you can:

  • Backup a single named volume.
  • Backup all active named volumes on your host.
  • Backup just the volumes you list in a separate file.
  • Restore a single backup to a named volume.

All backups are stored in compressed (xz) tar archives. Once you create a backup, you can copy it off-host, install it on another machine, share with friends, etc.

Installation

The preferred way to install vbart is with pipx:

pipx install vbart

Alternatively, you can create a separate virtual environment and install it the traditional way:

pip3 install vbart

Usage

For an overview, run:

vbart -h

Backup a Single Volume

vbart backup volume_name

For example, to backup a volume named mysql_db, use:

vbart backup mysql_db

vbart will then create a backup file in your current working directory named:

YYYYMMDD-mysql_db-backup.xz

Backup Multiple Volumes

vbart backups [-v VOLUMES]

Note the plural command name (backups as opposed to backup). VOLUMES is the optional name of a textfile that contains case sensitive volume names (one per line) that you want to backup. Within VOLUMES blank lines and lines beginning with # are ignored, so you can comment the file if you wish.

If VOLUMES is not specified, all active docker volumes on the current host are backed up. All volume backups are saved in the current working directory and named as:

YYYYMMDD-{volume_name}-backup.xz

Restore a Single Volume

vbart restore backup_file volume_name

The first argument (backup_file) is the compressed tar archive you created when you made a backup. The file must have a .xz extension.

The second argument (volume_name) is the named volume to create from the backup. If the named volume already exists, vbart will terminate with no action. Otherwise, a new empty volume will be created with the given name and the backup will be restored to that volume.

Refresh vbart

If vbart is interrupted during execution (e.g. hitting Control+C), then there may be dangling docker containers that hang on to existing volumes. Running the refresh command will clear those dangling containers.

Also, when you run vbart for the first time it creates a small (alpine-based) docker image to perform the actual backups. This image is called vbart_utility. The refresh command also deletes the utility image, causing it to be recreated the next time you run vbart.

To refresh vbart, use:

vbart refresh

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

This project uses the docker library which is licensed under the Apache 2.0 License. The full license text can be found in the LICENSE-APACHE-2_0 file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vbart-0.1.3.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

vbart-0.1.3-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file vbart-0.1.3.tar.gz.

File metadata

  • Download URL: vbart-0.1.3.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0

File hashes

Hashes for vbart-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3bfb283bf158b9c45cc9f9a3ce562052daa2f76a15aefeaaecc908c35c7d266c
MD5 34222f8a3a55300197a9553afe699a4a
BLAKE2b-256 71a0f1ac51f1cc9de0b4cad28a960ff9c66e46063d772493b367f0626cecf044

See more details on using hashes here.

File details

Details for the file vbart-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: vbart-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0

File hashes

Hashes for vbart-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 451c02d3a99cd27dd3c015bccb85cea589007ac115f863aeb7484d5065a0e974
MD5 bf4f99d33f5bf971aa4db780399bd5ad
BLAKE2b-256 2b56806c854044d29c924ea1f9a8f33e58508a450c96f124f3028e5aa296070f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page