From df7d5d7b60641d17d87e2b50911124cb65f954fd Mon Sep 17 00:00:00 2001 From: Mark Ryan Date: Wed, 26 Jul 2023 11:16:28 +0000 Subject: [PATCH] unix: automatically remove container created by mkall.sh When GOOS=linux, mkall.sh creates a container to run linux/mkall.go. It does not remove this container before exiting. Therefore each time you run mkall.sh on Linux you end up with a new stopped container that must be manually deleted with docker rm. This is cumbersome as it may take several runs of mkall.sh to develop and test a patch for golang/x/sys/unix resulting in multiple containers that require manual removal. It's also a little counterintuitive as the user doesn't invoke the docker command directly so it's not obvious that manual cleanup is required after mkall.sh completes. The leftover containers aren't even that useful for debugging as they have an entrypoint set. Change-Id: I92a94ae53078f0095d3ddf1d95c4879f1bc1cb2a Reviewed-on: https://go-review.googlesource.com/c/sys/+/513335 Auto-Submit: Tobias Klauser Reviewed-by: David Chase Reviewed-by: Florian Lehner Reviewed-by: Junyang Shao LUCI-TryBot-Result: Go LUCI Reviewed-by: Tobias Klauser --- unix/mkall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/mkall.sh b/unix/mkall.sh index d0ed6119..f6ddee1a 100755 --- a/unix/mkall.sh +++ b/unix/mkall.sh @@ -51,7 +51,7 @@ if [[ "$GOOS" = "linux" ]]; then # Files generated through docker (use $cmd so you can Ctl-C the build or run) set -e $cmd docker build --tag generate:$GOOS $GOOS - $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS + $cmd docker run --rm --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS exit fi