From c8fa8092c5d2ffab48af9c5dea92a0f7765c5e4c Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 7 Feb 2020 21:17:00 +0100 Subject: [PATCH] scripts: dev_cli: Run unprivileged containers as the host user By default we will run as root inside the container, which means all the build artifacts will be owned by root. That prevents us from properly cleaning our build from an unprivileged host user. Signed-off-by: Samuel Ortiz --- scripts/dev_cli.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/dev_cli.sh b/scripts/dev_cli.sh index fe20cec8f..8441e3f40 100755 --- a/scripts/dev_cli.sh +++ b/scripts/dev_cli.sh @@ -163,6 +163,7 @@ cmd_build() { [ $build = "release" ] && cargo_args+=("--release") $DOCKER_RUNTIME run \ + --user "$(id -u):$(id -g)" \ --workdir "$CTR_CLH_ROOT_DIR" \ --rm \ --volume /dev:/dev \ @@ -186,6 +187,7 @@ cmd_clean() { cargo_args=("$@") $DOCKER_RUNTIME run \ + --user "$(id -u):$(id -g)" \ --workdir "$CTR_CLH_ROOT_DIR" \ --rm \ --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \ @@ -230,6 +232,7 @@ cmd_tests() { if [ "$cargo" = true ] ; then say "Running cargo tests..." $DOCKER_RUNTIME run \ + --user "$(id -u):$(id -g)" \ --workdir "$CTR_CLH_ROOT_DIR" \ --rm \ --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \