From 6fca251dc18835752d2ad856e27193665bc484b7 Mon Sep 17 00:00:00 2001
From: Richard Gomez <32133502+rgmz@users.noreply.github.com>
Date: Mon, 15 Jul 2024 14:07:38 -0400
Subject: [PATCH] Gracefully handle no args being passed to entrypoint (#3589)

Signed-off-by: Richard Gomez <rmgomez368@gmail.com>
---
 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 0c507d17..b0f8e277 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())
-- 
GitLab