-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
run.sh
20 lines (16 loc) · 698 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
#adapted from https://github.com/kylemcdonald/ml-notebook/blob/master/run.sh
IMAGE="ml4a"
IMAGE_FILE="$IMAGE.tar"
JUPYTER_PORT=${JUPYTER_PORT:-8888}
HOST_IP=0.0.0.0
DIR=`pwd`
if ! ( docker images | grep "$IMAGE" &>/dev/null ) ; then
if [ -e $IMAGE_FILE ]; then
echo "The image will be loaded from $IMAGE_FILE (first time only, ~1 minute)."
docker load < $IMAGE_FILE
else
echo "The image will be downloaded from docker (first time only)."
fi
fi
docker run --publish $JUPYTER_PORT:$JUPYTER_PORT --volume=$DIR/:$DIR/ -ti $IMAGE /bin/bash -c "ln /dev/null /dev/raw1394 ; jupyter notebook --allow-root --no-browser --ip=$HOST_IP --port=$JUPYTER_PORT --notebook-dir=$DIR"