Browse code

Better error on 'docker deploy' when not in Swarm mode

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>

Aanand Prasad authored on 2016/07/29 19:12:20
Showing 1 changed files
... ...
@@ -52,6 +52,14 @@ func runDeploy(dockerCli *client.DockerCli, opts deployOptions) error {
52 52
 		return err
53 53
 	}
54 54
 
55
+	info, err := dockerCli.Client().Info(context.Background())
56
+	if err != nil {
57
+		return err
58
+	}
59
+	if !info.Swarm.ControlAvailable {
60
+		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.")
61
+	}
62
+
55 63
 	networks := getUniqueNetworkNames(bundle.Services)
56 64
 	ctx := context.Background()
57 65