Stop, export, compress, and restart docker containers.

Josh Bicking c365cca636 Merge pull request #1 from Josh1147582/tar 6 years ago
LICENSE 54697dd7c5 Initial commit 7 years ago
README.md 5ee4a315d3 properly formatted readme 7 years ago
docker-backup.sh 883372dde4 don't gzip exported containers 6 years 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.