From aab92ec7eca6b51df54fa3874cf0e3abbc04deb8 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Fri, 29 Jul 2016 11:12:20 +0100 Subject: [PATCH] Better error on 'docker deploy' when not in Swarm mode Signed-off-by: Aanand Prasad --- api/client/stack/deploy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api/client/stack/deploy.go b/api/client/stack/deploy.go index 5a1a5a5318..9cb1c16ef5 100644 --- a/api/client/stack/deploy.go +++ b/api/client/stack/deploy.go @@ -52,6 +52,14 @@ func runDeploy(dockerCli *client.DockerCli, opts deployOptions) error { return err } + info, err := dockerCli.Client().Info(context.Background()) + if err != nil { + return err + } + if !info.Swarm.ControlAvailable { + return fmt.Errorf("This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again.") + } + networks := getUniqueNetworkNames(bundle.Services) ctx := context.Background()