Last active
September 24, 2018 21:27
-
-
Save juampynr/f81a22965b1b57a03b26609b021762b9 to your computer and use it in GitHub Desktop.
Downloads a Drupal database dump from a Docker container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Downloads a database dump from a docker container | |
# | |
# Usage: | |
# sh db-download.sh [hostname] [user] [container] | |
set -x | |
HOST=$1 | |
USER=$2 | |
CONTAINER=$3 | |
ssh -v $USER@$HOST sudo docker exec -i $CONTAINER drush --root=/app/docroot sql-dump --result-file=/tmp/dump.sql | |
ssh -v $USER@$HOST "sudo docker cp $CONTAINER:/tmp/dump.sql /tmp/dump.sql" | |
scp -v -C $USER@$HOST:/tmp/dump.sql . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice and simple. It'd be great to add a
gzip
too to reduce file size and transfer.