diff --git a/compose/cli/main.py b/compose/cli/main.py index edc07d426..164769bbf 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -234,19 +234,15 @@ class TopLevelCommand(object): --no-cache Do not use cache when building the image. --pull Always attempt to pull a newer version of the image. -m, --memory MEM Sets memory limit for the build container. - --build-arg key=val Set build-time variables for one service. + --build-arg key=val Set build-time variables for services. """ - service_names = options['SERVICE'] build_args = options.get('--build-arg', None) if build_args: environment = Environment.from_env_file(self.project_dir) build_args = resolve_build_args(build_args, environment) - if not service_names and build_args: - raise UserError("Need service name for --build-arg option") - self.project.build( - service_names=service_names, + service_names=options['SERVICE'], no_cache=bool(options.get('--no-cache', False)), pull=bool(options.get('--pull', False)), force_rm=bool(options.get('--force-rm', False)), @@ -1030,7 +1026,8 @@ class TopLevelCommand(object): if cascade_stop: print("Aborting on container exit...") - all_containers = self.project.containers(service_names=options['SERVICE'], stopped=True) + all_containers = self.project.containers( + service_names=options['SERVICE'], stopped=True) exit_code = compute_exit_code( exit_value_from, attached_containers, cascade_starter, all_containers )