Browse code

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 <github@gone.nl>

Sebastiaan van Stijn authored on 2025/06/17 19:38:33
Showing 2 changed files
... ...
@@ -18,11 +18,13 @@ type ExecOptions struct {
18 18
 	AttachStdin  bool     // Attach the standard input, makes possible user interaction
19 19
 	AttachStderr bool     // Attach the standard error
20 20
 	AttachStdout bool     // Attach the standard output
21
-	Detach       bool     // Execute in detach mode
22 21
 	DetachKeys   string   // Escape keys for detach
23 22
 	Env          []string // Environment variables
24 23
 	WorkingDir   string   // Working directory
25 24
 	Cmd          []string // Execution commands and args
25
+
26
+	// Deprecated: the Detach field is not used, and will be removed in a future release.
27
+	Detach bool
26 28
 }
27 29
 
28 30
 // ExecStartOptions is a temp struct used by execStart
... ...
@@ -127,9 +127,8 @@ func TestExecResize(t *testing.T) {
127 127
 		cmd = []string{"sleep", "240"}
128 128
 	}
129 129
 	resp, err := apiClient.ContainerExecCreate(ctx, cID, containertypes.ExecOptions{
130
-		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
131
-		Detach: true,
132
-		Cmd:    cmd,
130
+		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
131
+		Cmd: cmd,
133 132
 	})
134 133
 	assert.NilError(t, err)
135 134
 	execID := resp.ID