From 936d328da9af334147b9fcb4448b8f2140cfeffb Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 9 Jun 2020 16:19:45 +0200 Subject: [PATCH] Use consistent name for errors This prevents inconsistent errors when using a symlink, or when renaming the binary; Before this change; ln -s $(which docker) toto ./toto rune docker: 'rune' is not a docker command. ./toto run daslkjadslkjdaslkj Unable to find image 'adslkjadslakdsj:latest' locally ./toto: Error response from daemon: pull access denied for adslkjadslakdsj, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. After this change: ln -s $(which docker) toto ./toto rune docker: 'rune' is not a docker command. ./toto run daslkjadslkjdaslkj Unable to find image 'adslkjadslakdsj:latest' locally docker: Error response from daemon: pull access denied for adslkjadslakdsj, repository does not exist or may require 'docker login': denied: requested access to the resource is den> Signed-off-by: Sebastiaan van Stijn (cherry picked from commit a3af1f47da75d5b0ca94a1f0f24d8d2028073c4e) Signed-off-by: Sebastiaan van Stijn --- cli/command/container/run.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cli/command/container/run.go b/cli/command/container/run.go index e9c2ffe0eb..a26035020f 100644 --- a/cli/command/container/run.go +++ b/cli/command/container/run.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "os" "runtime" "strings" "syscall" @@ -280,9 +279,9 @@ func attachContainer( func reportError(stderr io.Writer, name string, str string, withHelp bool) { str = strings.TrimSuffix(str, ".") + "." if withHelp { - str += "\nSee '" + os.Args[0] + " " + name + " --help'." + str += "\nSee 'docker " + name + " --help'." } - fmt.Fprintf(stderr, "%s: %s\n", os.Args[0], str) + fmt.Fprintln(stderr, "docker:", str) } // if container start fails with 'not found'/'no such' error, return 127