From a2627c831e0395472e5338f7050fdb7651f30b2a Mon Sep 17 00:00:00 2001 From: Richard Gomez Date: Thu, 20 Jun 2024 15:14:54 -0400 Subject: [PATCH] Gracefully handle no args being passed to entrypoint Signed-off-by: Richard Gomez --- cmd/docker-entrypoint/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/docker-entrypoint/main.go b/cmd/docker-entrypoint/main.go index 0c507d1712..b0f8e277f3 100644 --- a/cmd/docker-entrypoint/main.go +++ b/cmd/docker-entrypoint/main.go @@ -17,6 +17,10 @@ func main() { // Note that this docker-entrypoint program is args[0], and it is provided with the true process // args. args := os.Args[1:] + if len(args) == 0 { + fmt.Println("error: no args passed to entrypoint") + os.Exit(1) + } if err := run(args, realExec, realWhich); err != nil { fmt.Println("error:", err.Error())