|  | @@ -19,6 +19,7 @@ from ..config import config
 | 
	
		
			
				|  |  |  from ..config import ConfigurationError
 | 
	
		
			
				|  |  |  from ..config import parse_environment
 | 
	
		
			
				|  |  |  from ..config.serialize import serialize_config
 | 
	
		
			
				|  |  | +from ..const import API_VERSION_TO_ENGINE_VERSION
 | 
	
		
			
				|  |  |  from ..const import DEFAULT_TIMEOUT
 | 
	
		
			
				|  |  |  from ..const import HTTP_TIMEOUT
 | 
	
		
			
				|  |  |  from ..const import IS_WINDOWS_PLATFORM
 | 
	
	
		
			
				|  | @@ -64,7 +65,7 @@ def main():
 | 
	
		
			
				|  |  |          log.error("No such command: %s\n\n%s", e.command, commands)
 | 
	
		
			
				|  |  |          sys.exit(1)
 | 
	
		
			
				|  |  |      except APIError as e:
 | 
	
		
			
				|  |  | -        log.error(e.explanation)
 | 
	
		
			
				|  |  | +        log_api_error(e)
 | 
	
		
			
				|  |  |          sys.exit(1)
 | 
	
		
			
				|  |  |      except BuildError as e:
 | 
	
		
			
				|  |  |          log.error("Service '%s' failed to build: %s" % (e.service.name, e.reason))
 | 
	
	
		
			
				|  | @@ -84,6 +85,22 @@ def main():
 | 
	
		
			
				|  |  |          sys.exit(1)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +def log_api_error(e):
 | 
	
		
			
				|  |  | +    if 'client is newer than server' in e.explanation:
 | 
	
		
			
				|  |  | +        # we need JSON formatted errors. In the meantime...
 | 
	
		
			
				|  |  | +        # TODO: fix this by refactoring project dispatch
 | 
	
		
			
				|  |  | +        # http://github.com/docker/compose/pull/2832#commitcomment-15923800
 | 
	
		
			
				|  |  | +        client_version = e.explanation.split('client API version: ')[1].split(',')[0]
 | 
	
		
			
				|  |  | +        log.error(
 | 
	
		
			
				|  |  | +            "The engine version is lesser than the minimum required by "
 | 
	
		
			
				|  |  | +            "compose. Your current project requires a Docker Engine of "
 | 
	
		
			
				|  |  | +            "version {version} or superior.".format(
 | 
	
		
			
				|  |  | +                version=API_VERSION_TO_ENGINE_VERSION[client_version]
 | 
	
		
			
				|  |  | +            ))
 | 
	
		
			
				|  |  | +    else:
 | 
	
		
			
				|  |  | +        log.error(e.explanation)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  def setup_logging():
 | 
	
		
			
				|  |  |      root_logger = logging.getLogger()
 | 
	
		
			
				|  |  |      root_logger.addHandler(console_handler)
 |