feat: Kill previous container for the same project if it exists
This commit is contained in:
parent
6b315b2f44
commit
aee774329f
1 changed files with 11 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
# Set defaults
|
# Set defaults
|
||||||
BASEDIR="$(pwd)"
|
BASEDIR="$(pwd)"
|
||||||
|
BASEHASH="$(echo "$BASEDIR" |sha256sum |head -c7)"
|
||||||
ACTION="watch"
|
ACTION="watch"
|
||||||
VERBOSITY="0"
|
VERBOSITY="0"
|
||||||
DOCKER_IMAGE=glenux/teaching-boilerplate:latest
|
DOCKER_IMAGE=glenux/teaching-boilerplate:latest
|
||||||
|
@ -104,7 +105,17 @@ fi
|
||||||
if [ "$VERBOSITY" -gt 0 ]; then
|
if [ "$VERBOSITY" -gt 0 ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DOCKER_NAME="gx-teaching-$BASEHASH"
|
||||||
|
DOCKER_CID="$(docker ps -f "name=$DOCKER_NAME" -q)"
|
||||||
|
|
||||||
|
if [ -n "$DOCKER_CID" ]; then
|
||||||
|
docker kill "$DOCKER_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
docker run -i $DOCKER_OPT_TTY \
|
docker run -i $DOCKER_OPT_TTY \
|
||||||
|
--name "$DOCKER_NAME" \
|
||||||
|
--rm \
|
||||||
--shm-size=1gb \
|
--shm-size=1gb \
|
||||||
-e "EXT_UID=$(id -u)" \
|
-e "EXT_UID=$(id -u)" \
|
||||||
-e "EXT_GID=$(id -g)" \
|
-e "EXT_GID=$(id -g)" \
|
||||||
|
|
Loading…
Reference in a new issue