diff --git a/compose/service.py b/compose/service.py index a488b2c68c..f73fa96b46 100644 --- a/compose/service.py +++ b/compose/service.py @@ -157,7 +157,7 @@ class Service(object): - starts containers until there are at least `desired_num` running - removes all stopped containers """ - if not self.can_be_scaled(): + if self.specifies_host_port(): log.warn('Service %s specifies a port on the host. If multiple containers ' 'for this service are created on a single host, the port will clash.' % self.name) @@ -703,11 +703,11 @@ class Service(object): '{0}={1}'.format(LABEL_ONE_OFF, "True" if one_off else "False") ] - def can_be_scaled(self): + def specifies_host_port(self): for port in self.options.get('ports', []): if ':' in str(port): - return False - return True + return True + return False def pull(self, insecure_registry=False): if 'image' not in self.options: