Raise a more relevant error when dockerd is not available on the platform.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-04-27 13:08:20 -04:00
parent 625263e2c7
commit 765ab2b692
3 changed files with 10 additions and 3 deletions

View File

@ -1,11 +1,16 @@
// +build !daemon
package main
import (
"fmt"
"runtime"
"strings"
)
// CmdDaemon reports on an error on windows, because there is no exec
func (p DaemonProxy) CmdDaemon(args ...string) error {
return fmt.Errorf(
"`docker daemon` does not exist on windows. Please run `dockerd` directly")
"`docker daemon` is not supported on %s. Please run `dockerd` directly",
strings.Title(runtime.GOOS))
}

View File

@ -1,3 +1,5 @@
// +build !daemon
package main
import (
@ -9,7 +11,7 @@ func TestCmdDaemon(t *testing.T) {
proxy := NewDaemonProxy()
err := proxy.CmdDaemon("--help")
if err == nil {
t.Fatal("Expected CmdDaemon to fail in Windows.")
t.Fatal("Expected CmdDaemon to fail on Windows.")
}
if !strings.Contains(err.Error(), "Please run `dockerd`") {

View File

@ -1,4 +1,4 @@
// +build !windows
// +build daemon
package main