Skip to content

Instantly share code, notes, and snippets.

@genki
Created February 20, 2017 12:32
Show Gist options
  • Save genki/635eaf24b62fdf0e3adea64e9151eb78 to your computer and use it in GitHub Desktop.
Save genki/635eaf24b62fdf0e3adea64e9151eb78 to your computer and use it in GitHub Desktop.
#!/bin/sh
while [ "`echo $1 | cut -c1`" = "-" ]; do
OPT="$OPT $1"
shift
done
IMG_TAG=`echo $1 | awk -F\@ '{print $1}'`
CMD=`echo $1 | awk -F\@ '{print $2}'`
IMG=`echo $IMG_TAG | awk -F: '{print $1}'`
TAG=`echo $IMG_TAG | awk -F: '{print $2}'`
if [ -z "$CMD" ]; then
CMD=`echo $IMG | sed 's/.*\///'`
fi
docker run --rm -it -v$PWD:/mnt -w/mnt --entrypoint $CMD $OPT $IMG_TAG "${@:2}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment