Skip to content

Instantly share code, notes, and snippets.

@asv
Created May 2, 2017 10:46
Show Gist options
  • Save asv/035f19ed6949ab1231071bc656be921b to your computer and use it in GitHub Desktop.
Save asv/035f19ed6949ab1231071bc656be921b to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
set -e
if [[ $(docker inspect -f '{{ range .Mounts }}{{ if eq .Name "zk-data" }}{{ .Destination }}{{ end }}{{ end }}' zookeeper) == '/var/lib/zookeeper' ]]; then
VID1=$(docker inspect -f '{{ range .Mounts }}{{ if eq .Destination "/var/lib/zookeeper" }}{{ .Source }}{{ end }}{{ end }}' zookeeper)
VID2=$(docker inspect -f '{{ range .Mounts }}{{ if eq .Destination "/var/lib/zookeeper/data" }}{{ .Source }}{{ end }}{{ end }}' zookeeper)
rm -fr $VID1
cp -R $VID2 $VID1
fi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment