@@ -176,24 +176,9 @@ func applyRunOptions(project *types.Project, service *types.ServiceConfig, opts
176176}
177177
178178func (s * composeService ) startDependencies (ctx context.Context , project * types.Project , options api.RunOptions ) error {
179- dependencies := types.Services {}
180- var requestedService types.ServiceConfig
181- for name , service := range project .Services {
182- if name != options .Service {
183- dependencies [name ] = service
184- } else {
185- requestedService = service
186- }
187- }
188-
189- if len (dependencies ) > 0 {
190- project .Services = dependencies
191- project .DisabledServices [options .Service ] = requestedService
192- }
193- project .DisabledServices [options .Service ] = requestedService
194- delete (project .Services , options .Service )
179+ project = project .WithServicesDisabled (options .Service )
195180
196- err = s .Create (ctx , project , api.CreateOptions {
181+ err : = s .Create (ctx , project , api.CreateOptions {
197182 Build : options .Build ,
198183 IgnoreOrphans : options .IgnoreOrphans ,
199184 RemoveOrphans : options .RemoveOrphans ,
@@ -203,7 +188,7 @@ func (s *composeService) startDependencies(ctx context.Context, project *types.P
203188 return err
204189 }
205190
206- if len (dependencies ) > 0 {
191+ if len (project . Services ) > 0 {
207192 return s .Start (ctx , project .Name , api.StartOptions {
208193 Project : project ,
209194 })
0 commit comments