@@ -35,11 +35,12 @@ type execOpts struct {
3535 environment []string
3636 workingDir string
3737
38- noTty bool
39- user string
40- detach bool
41- index int
42- privileged bool
38+ noTty bool
39+ user string
40+ detach bool
41+ index int
42+ privileged bool
43+ interactive bool
4344}
4445
4546func execCommand (p * projectOptions , dockerCli command.Cli , backend api.Service ) * cobra.Command {
@@ -71,7 +72,7 @@ func execCommand(p *projectOptions, dockerCli command.Cli, backend api.Service)
7172 runCmd .Flags ().BoolVarP (& opts .noTty , "no-TTY" , "T" , ! dockerCli .Out ().IsTerminal (), "Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY." )
7273 runCmd .Flags ().StringVarP (& opts .workingDir , "workdir" , "w" , "" , "Path to workdir directory for this command." )
7374
74- runCmd .Flags ().BoolP ( "interactive" , "i" , true , "Keep STDIN open even if not attached." )
75+ runCmd .Flags ().BoolVarP ( & opts . interactive , "interactive" , "i" , true , "Keep STDIN open even if not attached." )
7576 runCmd .Flags ().MarkHidden ("interactive" ) //nolint:errcheck
7677 runCmd .Flags ().BoolP ("tty" , "t" , true , "Allocate a pseudo-TTY." )
7778 runCmd .Flags ().MarkHidden ("tty" ) //nolint:errcheck
@@ -103,6 +104,7 @@ func runExec(ctx context.Context, backend api.Service, opts execOpts) error {
103104 Index : opts .index ,
104105 Detach : opts .detach ,
105106 WorkingDir : opts .workingDir ,
107+ Interactive : opts .interactive ,
106108 }
107109
108110 exitCode , err := backend .Exec (ctx , projectName , execOpts )
0 commit comments