From 70d1e0c899d1272e71883a101da29a75df171361 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 29 Jul 2020 18:27:44 -0700 Subject: [PATCH] [build]: add --init option in docker run for better signal handling (#5066) --init: Run an init inside the container that forwards signals and reaps processes Before the change, process 1 is make, which does not do well to forward signals and reaps process. We could see zombie process left if user issues ctrl+c to interrupt the make process. with --init option, a docker-init process will forwards the signals and reaps processes. zombie process is no longer observed, and ctrl+c can reliably interrupt the make process. Before: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND lgh 1 0.3 0.0 12604 11908 pts/0 S+ 10:54 0:00 make ... After: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND lgh 1 0.0 0.0 1080 4 pts/0 Ss 10:54 0:00 /sbin/docker-init -- make ... lgh 7 0.3 0.0 12604 11908 pts/0 S+ 10:54 0:00 make ... Signed-off-by: Guohan Lu --- Makefile.work | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.work b/Makefile.work index 844e6d8939..430649557d 100644 --- a/Makefile.work +++ b/Makefile.work @@ -108,7 +108,7 @@ ifeq ($(DOCKER_BUILDER_WORKDIR),) override DOCKER_BUILDER_WORKDIR := "/sonic" endif -DOCKER_RUN := docker run --rm=true --privileged \ +DOCKER_RUN := docker run --rm=true --privileged --init \ -v $(DOCKER_BUILDER_MOUNT) \ -w $(DOCKER_BUILDER_WORKDIR) \ -e "http_proxy=$(http_proxy)" \