Created
June 2, 2016 01:54
-
-
Save dimaspivak/aef815fb634ae313715e5022b6daf4f4 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# This helper script is designed to be sourced, at which time its functions are made available | |
# to the user. Most functions defined have functionality defined by environmental variables, which | |
# can be set during invocation. For example, | |
# | |
# PULL=false clusterdock_run ./bin/... | |
clusterdock_run() { | |
# Variables: | |
# - CLUSTERDOCK_TARGET_DIR: a folder on the host to mount into /root/target in the clusterdock | |
# container | |
# - PULL: whether to pull the clusterdock image (either true or false; defaults to true) | |
CLUSTERDOCK_IMAGE="dimaspivak/hbase:clusterdock" | |
if [ "${PULL}" != "false" ]; then | |
sudo docker pull "${CLUSTERDOCK_IMAGE}" | |
fi | |
if [ -n "${CLUSTERDOCK_TARGET_DIR}" ]; then | |
TARGET_DIR_MOUNT="-v ${CLUSTERDOCK_TARGET_DIR}:/root/target" | |
fi | |
# The /etc/hosts bind-mount allows clusterdock to update /etc/hosts on the host machine for | |
# better access to internal container addresses. | |
sudo docker run --net=host \ | |
--privileged \ | |
${TARGET_DIR_MOUNT} \ | |
-v /tmp/clusterdock \ | |
-v /etc/hosts:/etc/hosts \ | |
-v /etc/localtime:/etc/localtime \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
"${CLUSTERDOCK_IMAGE}" $@ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment