Skip to content

Instantly share code, notes, and snippets.

@timothystewart6
Last active March 31, 2020 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timothystewart6/9614ed304b717fa319deb720930ac9b4 to your computer and use it in GitHub Desktop.
Save timothystewart6/9614ed304b717fa319deb720930ac9b4 to your computer and use it in GitHub Desktop.
A script to back up your rancher 2 installation with docker
docker stop rancher_docker_server
docker create --volumes-from rancher_docker_server --name rancher-data-"$(date +%F)" rancher/rancher:latest
docker run --volumes-from rancher-data-"$(date +%F)" -v $PWD:/backup:z busybox tar pzcvf /backup/rancher-data-backup-latest-"$(date +%F)".tar.gz /var/lib/rancher
docker rm rancher-data-"$(date +%F)"
docker start rancher_docker_server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment