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

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Upstream-commit: aab92ec7eca6b51df54fa3874cf0e3abbc04deb8
Component: engine
This commit is contained in:
Aanand Prasad
2016-07-29 11:12:20 +01:00
parent bbd602ff18
commit 1ec5da0bf9

View File

@ -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()