From 3e51fd982f5cd89f8ef8ec2986930bf0bef4a591 Mon Sep 17 00:00:00 2001 From: Andreas Hartmann Date: Mon, 28 Feb 2022 09:54:57 +0100 Subject: [PATCH] watch-serve: Remove containers after use Add the `--rm` flag to automatically delete the containers after they have been used. The script won't restart existing containers anyways, so there is no point in keeping them. It will only fill up the users disk. --- watch-serve.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/watch-serve.sh b/watch-serve.sh index c1802b4..3e975b4 100755 --- a/watch-serve.sh +++ b/watch-serve.sh @@ -19,14 +19,14 @@ if $(_exists podman); then echo "Using '$CRT' as container runtime" $CRT build --tag "$CONTAINER_NAME" -f Containerfile - $CRT run --userns keep-id --user "$(id -u):$(id -g)" -v "$PWD:$PWD:z" -w "$PWD" -p 1313:1313 $CONTAINER_NAME + $CRT run --rm -it --userns keep-id --user "$(id -u):$(id -g)" -v "$PWD:$PWD:z" -w "$PWD" -p 1313:1313 $CONTAINER_NAME elif $(_exists docker); then CRT="$(which docker)" echo "Using '$CRT' as container runtime" $CRT build --tag "$CONTAINER_NAME"