diff --git a/cmd/docker/daemon_windows.go b/cmd/docker/daemon_none.go similarity index 55% rename from cmd/docker/daemon_windows.go rename to cmd/docker/daemon_none.go index 41c0133b67..d66bf1a546 100644 --- a/cmd/docker/daemon_windows.go +++ b/cmd/docker/daemon_none.go @@ -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)) } diff --git a/cmd/docker/daemon_windows_test.go b/cmd/docker/daemon_none_test.go similarity index 80% rename from cmd/docker/daemon_windows_test.go rename to cmd/docker/daemon_none_test.go index 3da4e5d7cc..d75453bcc5 100644 --- a/cmd/docker/daemon_windows_test.go +++ b/cmd/docker/daemon_none_test.go @@ -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`") { diff --git a/cmd/docker/daemon_unix.go b/cmd/docker/daemon_unix.go index 896782b36c..7a27518636 100644 --- a/cmd/docker/daemon_unix.go +++ b/cmd/docker/daemon_unix.go @@ -1,4 +1,4 @@ -// +build !windows +// +build daemon package main diff --git a/hack/make.sh b/hack/make.sh index 36fe28bc18..e103a1aad8 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -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 diff --git a/hack/make/cross b/hack/make/cross index 37214da36a..dfcd144018 100644 --- a/hack/make/cross +++ b/hack/make/cross @@ -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"