1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 14:23:11 +00:00

refactor docker-run.sh

This commit is contained in:
Ivan Mikushin
2015-09-08 20:47:51 +05:00
parent bce7845dc5
commit 69970ed8ed
2 changed files with 23 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ build-all: ros-build-image
installer: ros-build-image
./scripts/docker-run.sh make -f Makefile.docker FORCE_PULL=$(FORCE_PULL) $@
./scripts/docker-run.sh --rm make -f Makefile.docker FORCE_PULL=$(FORCE_PULL) $@
version:

View File

@@ -12,5 +12,25 @@ if [ -c /dev/kvm ] || [ "${PRIVILEGED}" == "1" ]; then
DOCKER_ARGS="${DOCKER_ARGS} --privileged"
fi
docker rm -fv ros-build >/dev/null 2>&1 || true
exec docker run -i -v /var/run/docker.sock:/var/run/docker.sock $DOCKER_ARGS --name=ros-build ros-build "$@"
NAME=ros-build
while [ "$#" -gt 0 ]; do
case $1 in
--name)
shift 1
NAME="$1"
;;
--rm)
NAME=$(mktemp ${NAME}-XXXXXX)
rm $NAME
DOCKER_ARGS="${DOCKER_ARGS} --rm"
;;
*)
break
;;
esac
shift 1
done
DOCKER_ARGS="${DOCKER_ARGS} --name=${NAME}"
docker rm -fv ${NAME} >/dev/null 2>&1 || true
exec docker run -i -v /var/run/docker.sock:/var/run/docker.sock $DOCKER_ARGS ros-build "$@"