npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

backup-docker

v1.5.6

Published

A simple command line tool to backup and restore docker containers along with their volumes

Downloads

76

Readme

backup-docker

Node.js CI Coverage Status

A simple command line tool to backup and restore docker container inspection results and their volumes

The main idea of this package is to make backing up and restoring docker containers as easy as possible while avoiding backing up information that we can easily reproduce. This is achieved by backing up only the container's inspection files and the contents of their volumes. The inspection files can then be later used to recreate the same container, with the same settings, and the volume backups can be used to restore the contents of that container's volumes. This way we can have a backup of everything we would need to restore the container, while not bloating our backup files. All this of course assumes that the image is backed up elsewhere, as it usually is, like in a separate repository or DockerHub.

Installation

Requires node.js v8.0 or later

npm install -g backup-docker

Usage

There are 2 main commands:

  • backup - Creates a backup of the given container, or all if none is specified, and it's volumes
  • restore - Restores containers and volumes from existing backup files.

When run, two directories are created if not already present in the target directory (defaults to current working directory):

  • containers - Used to store container inspection files as .json files
  • volumes - Used to store the contents of volumes as .tar files

When run with restore command, backup-docker will expect these folders to exist in the target directory, if they don't, it will create them

By default, backup-docker will not backup non-persistent volumes (unnamed) and contents of NFS volumes. This is because it is assumed, that non-persistent volumes don't contain anything worth backing up and NFS volumes are already backed up by whoever is hosting them. This can be altered with the --non-persistent-volumes and --nfs-volume-contents flags.

Examples

  • backup-docker backup - Will backup all containers in the docker instance, and their volumes
  • backup-docker restore - Will restore all containers in containers folder, and their volumes
  • backup-docker backup banana - Will backup only the container named "banana" and all of it's volumes
  • backup-docker restore banana mango - Will restore only the containers named "banana" and "mango" and all of their volumes
  • backup-docker restore banana --only-containers - Will restore only the container named "banana" and not it's volumes
  • backup-docker restore banana --only-volumes - Will restore the volumes attached to the container named "banana" but not the container itself. The container itself must already exist in the docker instance

All general options

  • -v, --version - output the version number
  • -d, --directory [directory] - directory name to save to or look for container backups (default: current working directory)
  • -s, --socket-path [socket-path] - docker socket path
  • --only-containers - backup/restore containers only
  • --only-volumes - backup/restore volumes only. If used with the restore command then the container is expected to already exist and the container names, if not provided, are still taken from backups
  • -h, --help - output usage information

Backup specific options

  • --nfs-volume-contents - also backup the contents of nfs volumes
  • --non-persistent-volumes - also backup non-persistent (unnamed) volumes