2021-02-24 16:19:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Run the container
|
2021-05-06 20:32:48 +00:00
|
|
|
# $0 [docker arguments] [-- command and arguments]
|
2021-02-24 16:19:24 +00:00
|
|
|
|
|
|
|
prefix=kdave
|
|
|
|
image=$(basename `pwd` | tr '[A-Z]' '[a-z]')
|
|
|
|
|
|
|
|
declare -a ARGS
|
2021-05-06 20:32:48 +00:00
|
|
|
while [ $# -gt 0 ]; do
|
2021-02-24 16:19:24 +00:00
|
|
|
case "$1" in
|
|
|
|
--) shift; break;;
|
2021-05-06 20:32:48 +00:00
|
|
|
*) ARGS+=("$1"); shift;;
|
2021-02-24 16:19:24 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "ARGS: ${ARGS[@]}"
|
|
|
|
echo "RUN : $@"
|
|
|
|
|
|
|
|
# Device mapper devices are not visible inside the environment if the /dev mount
|
|
|
|
# is the default one (tmpfs instead of devtmpfs)
|
|
|
|
# Mounts and loop device manipulation is required
|
|
|
|
docker run --mount type=bind,source=/dev,target=/dev -it --privileged "${ARGS[@]}" "$prefix/$image" "$@"
|