Skip to content

Commit 991b130

Browse files
committed
chore: restore ctx without cancel on container run
Signed-off-by: Alano Terblanche <[email protected]>
1 parent 0579cd7 commit 991b130

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cli/command/container/run.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ func runRun(ctx context.Context, dockerCli command.Cli, flags *pflag.FlagSet, ro
119119

120120
//nolint:gocyclo
121121
func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOptions, copts *containerOptions, containerCfg *containerConfig) error {
122+
ctx = context.WithoutCancel(ctx)
123+
122124
config := containerCfg.Config
123125
stdout, stderr := dockerCli.Out(), dockerCli.Err()
124126
apiClient := dockerCli.Client()
@@ -181,7 +183,7 @@ func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOption
181183
// ctx should not be cancellable here, as this would kill the stream to the container
182184
// and we want to keep the stream open until the process in the container exits or until
183185
// the user forcefully terminates the CLI.
184-
closeFn, err := attachContainer(context.WithoutCancel(ctx), dockerCli, containerID, &errCh, config, container.AttachOptions{
186+
closeFn, err := attachContainer(ctx, dockerCli, containerID, &errCh, config, container.AttachOptions{
185187
Stream: true,
186188
Stdin: config.AttachStdin,
187189
Stdout: config.AttachStdout,

0 commit comments

Comments
 (0)