-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-run.sh
executable file
·63 lines (60 loc) · 1.71 KB
/
docker-run.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /usr/bin/env bash
# print the usage and exit
print_usage_and_exit () {
cat <<____USAGE 1>&2
Usage : ${0##*/} <var1> <var2> ...
____USAGE
exit 1
}
# main script starts here
if [ $1 = 'run' ]; then
docker run \
-v $PWD:/tmp/working \
-w=/tmp/working \
--rm \
-it \
--name kaggle-python \
gcr.io/kaggle-images/python@sha256:af3e19d6210754b09d3ae97d30210712ff183877ab6d0fa71485a0dd7c1f33b3 \
python $2
elif [ $1 = 'jp' ]; then
docker run \
-v $PWD:/tmp/working \
-w=/tmp/working \
-p 8080:8080 \
--rm \
-it \
--name kaggle-jupyter \
gcr.io/kaggle-images/python@sha256:af3e19d6210754b09d3ae97d30210712ff183877ab6d0fa71485a0dd7c1f33b3 \
jupyter notebook \
--no-browser \
--ip=0.0.0.0 \
--allow-root \
--notebook-dir=/tmp/working
elif [ $1 = 'flake' ]; then
docker run \
-v $PWD:/tmp/working \
-w=/tmp/working \
--rm \
-it \
--name kaggle-python \
gcr.io/kaggle-images/python@sha256:af3e19d6210754b09d3ae97d30210712ff183877ab6d0fa71485a0dd7c1f33b3 \
flake8 $2
elif [ $1 = 'script' ]; then
docker run \
-v $PWD:/tmp/working \
-w=/tmp/working \
--rm \
-it \
--name kaggle-python \
gcr.io/kaggle-images/python@sha256:af3e19d6210754b09d3ae97d30210712ff183877ab6d0fa71485a0dd7c1f33b3 \
python $2 $3
else
docker run \
-v $PWD:/tmp/working \
-w=/tmp/working \
--rm \
-it \
--name kaggle-python \
gcr.io/kaggle-images/python@sha256:af3e19d6210754b09d3ae97d30210712ff183877ab6d0fa71485a0dd7c1f33b3 \
$1
fi