Merge pull request #3676 from aanand/warn-for-swarm-mode

Show a warning when engine is in swarm mode
This commit is contained in:
Aanand Prasad 2016-07-27 15:38:09 +01:00 committed by GitHub
commit e9d62e8404
3 changed files with 248 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://docs.docker.com/compose/bundles\n"
)
class NoSuchService(Exception):
def __init__(self, name):
self.name = name