1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00

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

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 8983d42988ad59f1a19a0f4e9e88dfec8b1be690
Component: engine
This commit is contained in:
Daniel Nephin
2016-04-27 13:08:20 -04:00
parent 56c66fb13e
commit 86a8cdbb4b
5 changed files with 15 additions and 4 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

View File

@@ -127,6 +127,7 @@ if [ "$DOCKER_EXPERIMENTAL" ]; then
DOCKER_BUILDTAGS+=" experimental"
fi
DOCKER_BUILDTAGS+=" daemon"
if pkg-config 'libsystemd >= 209' 2> /dev/null ; then
DOCKER_BUILDTAGS+=" journald"
elif pkg-config 'libsystemd-journal' 2> /dev/null ; then

View File

@@ -35,7 +35,10 @@ for platform in $DOCKER_CROSSPLATFORMS; do
fi
if [ -z "${daemonSupporting[$platform]}" ]; then
export LDFLAGS_STATIC_DOCKER="" # we just need a simple client for these platforms
# we just need a simple client for these platforms
export LDFLAGS_STATIC_DOCKER=""
# remove the "daemon" build tag from platforms that aren't supported
export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" )
source "${MAKEDIR}/binary-client"
else
source "${MAKEDIR}/binary-client"