Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit d3eaf15

Browse files
ndeloofPacoVK
authored andcommitted
docker-compose parity: start implies --detach (otherwise, use up)
Signed-off-by: Nicolas De Loof <[email protected]> Signed-off-by: Pascal Euhus <[email protected]>
1 parent 477a518 commit d3eaf15

File tree

1 file changed

+2
-31
lines changed

1 file changed

+2
-31
lines changed

cli/cmd/compose/start.go

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ package compose
1818

1919
import (
2020
"context"
21-
2221
"github.com/docker/compose-cli/api/client"
2322
"github.com/docker/compose-cli/api/compose"
2423
"github.com/docker/compose-cli/api/progress"
25-
2624
"github.com/spf13/cobra"
2725
)
2826

2927
type startOptions struct {
3028
*projectOptions
31-
Detach bool
3229
}
3330

3431
func startCommand(p *projectOptions) *cobra.Command {
@@ -42,8 +39,6 @@ func startCommand(p *projectOptions) *cobra.Command {
4239
return runStart(cmd.Context(), opts, args)
4340
},
4441
}
45-
46-
startCmd.Flags().BoolVarP(&opts.Detach, "detach", "d", false, "Detached mode: Run containers in the background")
4742
return startCmd
4843
}
4944

@@ -58,32 +53,8 @@ func runStart(ctx context.Context, opts startOptions, services []string) error {
5853
return err
5954
}
6055

61-
if opts.Detach {
62-
_, err = progress.Run(ctx, func(ctx context.Context) (string, error) {
63-
return "", c.ComposeService().Start(ctx, project, compose.StartOptions{})
64-
})
65-
return err
66-
}
67-
68-
queue := make(chan compose.ContainerEvent)
69-
printer := printer{
70-
queue: queue,
71-
}
72-
err = c.ComposeService().Start(ctx, project, compose.StartOptions{
73-
Attach: func(event compose.ContainerEvent) {
74-
queue <- event
75-
},
76-
})
77-
if err != nil {
78-
return err
79-
}
80-
81-
_, err = printer.run(ctx, false, "", nil, func() error {
82-
ctx := context.Background()
83-
_, err := progress.Run(ctx, func(ctx context.Context) (string, error) {
84-
return "", c.ComposeService().Stop(ctx, project)
85-
})
86-
return err
56+
_, err = progress.Run(ctx, func(ctx context.Context) (string, error) {
57+
return "", c.ComposeService().Start(ctx, project, compose.StartOptions{})
8758
})
8859
return err
8960
}

0 commit comments

Comments
 (0)