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:
@@ -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 "$@"
|
||||
|
Reference in New Issue
Block a user