From 0c182d4d57e30e77fd940201205db20403fc7282 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 17 Jun 2025 12:38:33 +0200 Subject: [PATCH] api/types/container: deprecate ExecOptions.Detach This field was added in 5130fe5d38837302e72bdc5e4bd1f5fa1df72c7f, which added it for use as intermediate struct when parsing CLI flags (through `runconfig.ParseExec`) in c786a8ee5e9db8f5f609cf8721bd1e1513fb0043. Commit 9d9dff3d0d9e92adf7c2e59f94c63766659d1d47 rewrote the CLI to use Cobra, and as part of this introduced a separate `execOptions` type in `api/client/container`. Signed-off-by: Sebastiaan van Stijn --- api/types/container/exec.go | 4 +++- integration/container/exec_test.go | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/types/container/exec.go b/api/types/container/exec.go index f4b22376ef..e455cd27b2 100644 --- a/api/types/container/exec.go +++ b/api/types/container/exec.go @@ -18,11 +18,13 @@ type ExecOptions struct { AttachStdin bool // Attach the standard input, makes possible user interaction AttachStderr bool // Attach the standard error AttachStdout bool // Attach the standard output - Detach bool // Execute in detach mode DetachKeys string // Escape keys for detach Env []string // Environment variables WorkingDir string // Working directory Cmd []string // Execution commands and args + + // Deprecated: the Detach field is not used, and will be removed in a future release. + Detach bool } // ExecStartOptions is a temp struct used by execStart diff --git a/integration/container/exec_test.go b/integration/container/exec_test.go index 867ffef530..6460a8bd06 100644 --- a/integration/container/exec_test.go +++ b/integration/container/exec_test.go @@ -127,9 +127,8 @@ func TestExecResize(t *testing.T) { cmd = []string{"sleep", "240"} } resp, err := apiClient.ContainerExecCreate(ctx, cID, containertypes.ExecOptions{ - Tty: true, // Windows requires a TTY for the resize to work, otherwise fails with "is not a tty: failed precondition", see https://github.com/moby/moby/pull/48665#issuecomment-2412530345 - Detach: true, - Cmd: cmd, + Tty: true, // Windows requires a TTY for the resize to work, otherwise fails with "is not a tty: failed precondition", see https://github.com/moby/moby/pull/48665#issuecomment-2412530345 + Cmd: cmd, }) assert.NilError(t, err) execID := resp.ID