You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
809 B
Bash
47 lines
809 B
Bash
|
6 years ago
|
#!/bin/bash
|
||
|
|
|
||
|
|
PWD=$(cd `dirname $0`;pwd);
|
||
|
|
|
||
|
|
IMG_NAME="springbootstart"
|
||
|
|
IMG_VER='1.0.1'
|
||
|
|
PORT=8090
|
||
|
|
|
||
|
|
if [ $# -gt 1 ];then
|
||
|
|
PORT=$2
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ $# -gt 2 ];then
|
||
|
|
IMG_VER=$3
|
||
|
|
fi
|
||
|
|
|
||
|
|
NAME="springbootstart-$IMG_VER"
|
||
|
|
|
||
|
|
run() {
|
||
|
|
echo "docker run --restart=on-failure:10 --name $NAME -d -p$PORT:8080 ${IMG_NAME}:${IMG_VER}"
|
||
|
|
docker run --restart=on-failure:10 --name $NAME -d -p$PORT:8080 ${IMG_NAME}:${IMG_VER}
|
||
|
|
}
|
||
|
|
|
||
|
|
case $1 in
|
||
|
|
start)
|
||
|
|
docker start $NAME
|
||
|
|
exit $?
|
||
|
|
;;
|
||
|
|
stop)
|
||
|
|
docker stop $NAME
|
||
|
|
exit $?
|
||
|
|
;;
|
||
|
|
rm)
|
||
|
|
docker rm $NAME
|
||
|
|
exit $?
|
||
|
|
;;
|
||
|
|
run)
|
||
|
|
run
|
||
|
|
exit $?
|
||
|
|
;;
|
||
|
|
*)
|
||
|
|
echo "Usage: run.sh {start|stop|rm|run} port version." >&2
|
||
|
|
echo "port and version are optional." >&2
|
||
|
|
exit 1
|
||
|
|
;;
|
||
|
|
esac
|