diff --git a/builder/Dockerfile b/builder/Dockerfile index a00fde24..6beedf6b 100644 --- a/builder/Dockerfile +++ b/builder/Dockerfile @@ -44,4 +44,7 @@ RUN mkdir -p /var/empty /etc/haproxy /var/lib/haproxy /var/run/haproxy\ STOPSIGNAL SIGTERM USER haproxy + +# dumb-init reaps the old haproxy process in the embedded, non master-worker mode, +# after receiving SIGUSR1, avoiding it to become a zombie. ENTRYPOINT ["/usr/bin/dumb-init", "--", "/start.sh"] diff --git a/pkg/haproxy/instance.go b/pkg/haproxy/instance.go index ed7ca7ee..6dba450e 100644 --- a/pkg/haproxy/instance.go +++ b/pkg/haproxy/instance.go @@ -637,6 +637,7 @@ func (i *instance) startHAProxySync() { "-f", i.options.HAProxyCfgDir) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr + cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} if err := cmd.Start(); err != nil { i.logger.Error("error starting haproxy: %v", err) return diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index d5ece7ed..fb1d8d0e 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -27,4 +27,7 @@ RUN mkdir -p /var/empty /etc/haproxy /var/lib/haproxy /var/run/haproxy\ STOPSIGNAL SIGTERM USER haproxy + +# dumb-init reaps the old haproxy process in the embedded, non master-worker mode, +# after receiving SIGUSR1, avoiding it to become a zombie. ENTRYPOINT ["/usr/bin/dumb-init", "--", "/start.sh"]