Created
August 4, 2020 13:29
-
-
Save fnordfish/320091fd7433fccfcc47dc32e641adf8 to your computer and use it in GitHub Desktop.
copy big data dirs into docker container and sync back
This file contains 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
SRC_PATH=../big_data_dir | |
DEST_PATH=/var/data | |
SERVICE=app |
This file contains 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
script_dir=$(dirname $(realpath $0)) | |
source ${script_dir}/env_dev | |
docker-compose up -d ${SERVICE} | |
CONTAINER=$(docker-compose ps -q ${SERVICE}) | |
${script_dir}/sync_up.sh ${CONTAINER} | |
docker-compose exec ${SERVICE} bash | |
${script_dir}/sync_down.sh ${CONTAINER} | |
docker-compose stop ${SERVICE} | |
docker rm ${CONTAINER} |
This file contains 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
source $(dirname $(realpath $0))/env_dev | |
CONTAINER=${1:-$(docker-compose ps -q ${SERVICE})} | |
echo "Copy pages dir back to host" | |
docker exec -i ${CONTAINER} tar -cf - -C ${DEST_PATH} $(basename ${SRC_PATH}) | tar -xpf - -C $(dirname $(realpath ${SRC_PATH})) |
This file contains 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
source $(dirname $(realpath $0))/env_dev | |
CONTAINER=${1:-$(docker-compose ps -q ${SERVICE})} | |
echo "Copy pages dir into Container $CONTAINER" | |
tar -cf - -C $(dirname $(realpath ${SRC_PATH})) $(basename ${SRC_PATH}) | docker exec -i ${CONTAINER} tar -xpf - -C ${DEST_PATH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment