Skip to content

Instantly share code, notes, and snippets.

@terkhorn
Last active August 29, 2015 14:08
Show Gist options
  • Save terkhorn/516385080bf201698773 to your computer and use it in GitHub Desktop.
Save terkhorn/516385080bf201698773 to your computer and use it in GitHub Desktop.
Simple docker-run script
#!/bin/bash
### USAGE:
### First argument passed to this script is the local volume to mount
### to your docker image. Defaults to "/data".
### ATTENTION OSX USERS!
### IN YOUR .bashrc or .bash_profile, add the following line:
###
### export DOCKER_NOSUDO=1
###
### THIS WILL ALLOW YOU TO AVOID PREFIXING SUDO TO MAC OSX INVOCATION.
DATA_DIR=${1-/data}
shift
if [ -z ${DOCKER_NOSUDO} ]; then CMD="sudo docker"; else CMD="docker"; fi
$CMD run -P -v $DATA_DIR:/data -t -i $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment