Created
January 17, 2018 06:53
-
-
Save hiroara/4204c39be9e988bcf8ec155d591dafaf to your computer and use it in GitHub Desktop.
Export a docker volume
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
#!/bin/bash | |
IMAGE=${IMAGE:-alpine:3.7} | |
TARGET_VOLUME=$1 | |
if [ -z ${TARGET_VOLUME} ]; then | |
echo "Usage $0 <volume name>" | |
exit 1 | |
fi | |
docker run -it --rm \ | |
-v ${TARGET_VOLUME}:/src \ | |
-v ${PWD}:/dest \ | |
${IMAGE} cp -R /src /dest/${TARGET_VOLUME}-$(date +%Y%m%d%H%M) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment