From fe84af7dfee52aa4585d89833db13fa0366e35e1 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Sun, 6 Jun 2021 20:48:49 -0500 Subject: [PATCH] Switch from CMD to entrypoint CMD runs a shell which then runs what is specified. ENTRYPOINT simply runs what is specified When K8s tries to delete a Pod, PAUSE sends SIGTERM to the running process in the container. After 30s, if the process has not exited, PAUSE sends SIGKILL. The container isn't *actually* deleted until PAUSE exits. PAUSE will exit when all its children are dead. Using CMD puts a shell between the PAUSE container and the running process. The shell doesn't properly pass on the SIGTERM. Using ENTRYPOINT removes that intermediate shell, and allows the container to exit much much faster in K8s. Signed-off-by: Ed Warnicke --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 125d43d..35603ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,4 +23,4 @@ CMD dlv -l :40000 --headless=true --api-version=2 test -test.v ./... FROM alpine as runtime COPY --from=build /bin/registry-proxy-dns /bin/registry-proxy-dns -CMD /bin/registry-proxy-dns \ No newline at end of file +ENTRYPOINT ["/bin/registry-proxy-dns"]