Show a warning when engine is in swarm mode

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2016-07-01 13:54:27 -07:00
commit 2c9e46f60f
2 changed files with 48 additions and 0 deletions

View file

@ -369,6 +369,8 @@ class Project(object):
detached=False,
remove_orphans=False):
warn_for_swarm_mode(self.client)
self.initialize()
self.find_orphan_containers(remove_orphans)
@ -533,6 +535,20 @@ def get_volumes_from(project, service_dict):
return [build_volume_from(vf) for vf in volumes_from]
def warn_for_swarm_mode(client):
info = client.info()
if info.get('Swarm', {}).get('LocalNodeState') == 'active':
log.warn(
"The Docker Engine you're using is running in swarm mode.\n\n"
"Compose does not use swarm mode to deploy services to multiple nodes in a swarm. "
"All containers will be scheduled on the current node.\n\n"
"To deploy your application across the swarm, "
"use the bundle feature of the Docker experimental build.\n\n"
"More info:\n"
"https://github.com/docker/docker/tree/master/experimental\n"
)
class NoSuchService(Exception):
def __init__(self, name):
self.name = name