Skip to content

Instantly share code, notes, and snippets.

@xav-b
Created March 29, 2015 16:48
Show Gist options
  • Save xav-b/b6a03b63b690934d68f6 to your computer and use it in GitHub Desktop.
Save xav-b/b6a03b63b690934d68f6 to your computer and use it in GitHub Desktop.
Run a convenient sandbox container
#!/bin/bash
DEFAULT_NAME="lab"
DEFAULT_IMAGE="ubuntu"
WORKDIR="/root/app"
REPL="bash"
usage() {
printf "hack --help\t\tprint help\n"
printf "hack <image> <name>\trun a lab container\n"
}
hack() {
local image=${1:-${DEFAULT_IMAGE}}
local name=${2:-${DEFAULT_NAME}}
docker run \
-it --name ${name} \
--volume $PWD:${WORKDIR} --workdir ${WORKDIR} \
${image} ${REPL}
}
if [ "$1" == "--help" ]; then
usage
exit 0
fi
hack $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment