Stop, export, compress, and restart docker containers.

Josh Bicking c365cca636 Merge pull request #1 from Josh1147582/tar 1 year ago
LICENSE 54697dd7c5 Initial commit 2 years ago
README.md 5ee4a315d3 properly formatted readme 2 years ago
docker-backup.sh 883372dde4 don't gzip exported containers 1 year ago

README.md

docker-backup.sh

Stop, export, compress, and restart docker containers.

docker-backup.sh stops all running containers, exports them and gzips them to the current directory, then restarts the previously running containers in the reverse order of which they were stopped.

This script assumes it is being run as root, or the current user is in the docker group.

Usage: ./docker-backup.sh [args]

-a    Backup all containers, not just running containers. Only running containers will be
      restarted after backup (unless otherwise specified by -n)

-h    Print this help message.

-n    Don't restart containers after backup

-o OUTDIR    Backups are sent to OUTDIR, rather than the current directory

-v VOLUME (-v SECONDVOLUME -v THIRDVOLUME...)]
        Include volume directories with your backup. These are made once the container is
        stopped to avoid corruption.