mirror of https://github.com/docker/cli.git
chore: restore ctx without cancel on container run
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
This commit is contained in:
parent
0579cd7971
commit
991b1303da
|
@ -119,6 +119,8 @@ func runRun(ctx context.Context, dockerCli command.Cli, flags *pflag.FlagSet, ro
|
||||||
|
|
||||||
//nolint:gocyclo
|
//nolint:gocyclo
|
||||||
func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOptions, copts *containerOptions, containerCfg *containerConfig) error {
|
func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOptions, copts *containerOptions, containerCfg *containerConfig) error {
|
||||||
|
ctx = context.WithoutCancel(ctx)
|
||||||
|
|
||||||
config := containerCfg.Config
|
config := containerCfg.Config
|
||||||
stdout, stderr := dockerCli.Out(), dockerCli.Err()
|
stdout, stderr := dockerCli.Out(), dockerCli.Err()
|
||||||
apiClient := dockerCli.Client()
|
apiClient := dockerCli.Client()
|
||||||
|
@ -181,7 +183,7 @@ func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOption
|
||||||
// ctx should not be cancellable here, as this would kill the stream to the container
|
// ctx should not be cancellable here, as this would kill the stream to the container
|
||||||
// and we want to keep the stream open until the process in the container exits or until
|
// and we want to keep the stream open until the process in the container exits or until
|
||||||
// the user forcefully terminates the CLI.
|
// the user forcefully terminates the CLI.
|
||||||
closeFn, err := attachContainer(context.WithoutCancel(ctx), dockerCli, containerID, &errCh, config, container.AttachOptions{
|
closeFn, err := attachContainer(ctx, dockerCli, containerID, &errCh, config, container.AttachOptions{
|
||||||
Stream: true,
|
Stream: true,
|
||||||
Stdin: config.AttachStdin,
|
Stdin: config.AttachStdin,
|
||||||
Stdout: config.AttachStdout,
|
Stdout: config.AttachStdout,
|
||||||
|
|
Loading…
Reference in New Issue