Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

transport docker volume

##you can have following aliases in your .bashrc or .zshrc

# backup files from a docker volume into /tmp/backup.tar.gz
function docker-volume-backup-compressed() {
  docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -czvf /backup/backup.tar.gz "${@:2}"
}
# restore files from /tmp/backup.tar.gz into a docker volume
function docker-volume-restore-compressed() {
  docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:2}"
  echo "Double checking files..."
  docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie ls -lh "${@:2}"
}
# backup files from a docker volume into /tmp/backup.tar
function docker-volume-backup() {
  docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -cvf /backup/backup.tar "${@:2}"
}
# restore files from /tmp/backup.tar into a docker volume
function docker-volume-restore() {
  docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -xvf /backup/backup.tar "${@:2}"
  echo "Double checking files..."
  docker run --rm -v /tmp:/backup --volumes-from "$1" busybox ls -lh "${@:2}"
}


##Note that the backup is saved into /tmp, so you can move the backup file saved there between docker hosts.
Comment

PREVIOUS NEXT
Code Example
Shell :: pm2 
Shell :: yes/no maybe 
Shell :: install any desc ubunto 
Shell :: gitignore new monified file ? 
Shell :: Setup launcher icon for smartgit 
Shell :: django flush sessions on server startup 
Shell :: mount one directory to another in mac 
Shell :: sudo msys2 
Shell :: como instalar ext-mbstring en ubuntu 18.04 
Shell :: xampp in manjaro linux 
Shell :: linux restrict process network access 
Shell :: install google client api individually 
Shell :: container has runAsNonRoot and image has non-numeric user 
Shell :: wget -v usage 
Shell :: node-pre-gyp ERR! install response status 404 Not Found 
Shell :: The lsb_release command ubuntu faq 
Shell :: bash awk remove one specific column 
Shell :: logstash automatic config reload 
Shell :: Turn on bluetooth in kali linux / soft unblock 
Shell :: elevate current commandprompt 
Shell :: The requested URL was not found on this server. Apache/2.4.29 (Ubuntu) Server at 
Shell :: git ignore is not working on local repository 
Shell :: LF will be replaced by CRLF hassan 
Shell :: read not working in shell script 
Shell :: how to add new path to sudoers 
Shell :: laravel minify css 
Shell :: add exist code to git repository azure 
Shell :: git config --system core.longpaths true premission denied 
Shell :: create permanent shortcut command ubuntu 
Shell :: powershell write to fgile 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =