File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,18 @@ PORT=${PORT:-8888}
4
4
SRC_DIR=${SRC_DIR:- `pwd`}
5
5
NOTEBOOK_DIR=${NOTEBOOK_DIR:- $SRC_DIR / notebooks}
6
6
TOKEN=$( openssl rand -hex 24)
7
+ CONTAINER_NAME=${CONTAINER_NAME:- pymc3}
7
8
8
9
# stop and remove previous instances of the pymc3 container to avoid naming conflicts
9
- docker stop pymc3
10
- docker rm pymc3
10
+ if [[ $( docker ps -q -f name=${CONTAINER_NAME} ) ]]; then
11
+ echo " Shutting down and removing previous instance of ${CONTAINER_NAME} container..."
12
+ docker rm -f ${CONTAINER_NAME}
13
+ fi
11
14
12
15
# note that all paths are relative to the build context, so . represents
13
16
# SRC_DIR to Docker
14
17
docker build \
15
- -t pymc3 \
18
+ -t ${CONTAINER_NAME} \
16
19
-f $SRC_DIR /scripts/Dockerfile \
17
20
--build-arg SRC_DIR=. \
18
21
$SRC_DIR
@@ -21,7 +24,7 @@ docker run -d \
21
24
-p $PORT :8888 \
22
25
-v $SRC_DIR :/home/jovyan/ \
23
26
-v $NOTEBOOK_DIR :/home/jovyan/work/ \
24
- --name pymc3 pymc3 \
27
+ --name ${CONTAINER_NAME} ${CONTAINER_NAME} \
25
28
start-notebook.sh --NotebookApp.token=${TOKEN}
26
29
27
30
if [[ $* != * --no-browser* ]]; then
You can’t perform that action at this time.
0 commit comments