forked from russelljjarvis/docker-stacks-returned
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·28 lines (27 loc) · 1.06 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
NAME=$1
CONTAINER_STATUS=$(docker ps -a --filter="name=$NAME" -q | xargs) # Is the container running?
if [ $CONTAINER_STATUS ]; then # If so...
docker rm -f $CONTAINER_STATUS # Stop it and remove it.
fi
if ! [ $NOTEBOOK_HOME ]; then
NOTEBOOK_HOME=$HOME
fi
WORK_HOME=/home/jovyan/work
CMD="start-notebook.sh"
CMD_ARGS="--ip=0.0.0.0 --NotebookApp.token=\"\" --NotebookApp.disable_check_xsrf=True"
HOST_PORT=8888 # Open port on the host machine.
if [ "$2" = "-dev" ]; then
docker run -it --name="$NAME" \
-v $SCIDASH_HOME/sciunit:$WORK_HOME/sciunit \
-v $SCIDASH_HOME/neuronunit:$WORK_HOME/neuronunit \
-p $HOST_PORT:8888 -v $NOTEBOOK_HOME:$WORK_HOME/host \
scidash/$NAME $CMD $CMD_ARGS
else
docker run -d --name="$NAME" \
-p $HOST_PORT:8888 -v $NOTEBOOK_HOME:$WORK_HOME/host \
scidash/$NAME $CMD $CMD_ARGS
docker exec "$NAME" bash -c "ln -s \$HOME/sciunit/docs $WORK_HOME/sciunit-docs"
docker exec "$NAME" bash -c "ln -s \$HOME/neuronunit/docs $WORK_HOME/neuronunit-docs"
fi
# Now access the notebook server at http://localhost:$HOST_PORT