diff --git a/internal/task/step/container.go b/internal/task/step/container.go index 0ddd41a1f..61ba9ae18 100644 --- a/internal/task/step/container.go +++ b/internal/task/step/container.go @@ -119,6 +119,7 @@ type ( ContainerExec struct { ContainerId *string Command string + Detached bool Success *bool Out *string module.ExecOptions @@ -289,6 +290,9 @@ func (s *ListContainers) Execute(ctx *context.Context) error { func (s *ContainerExec) Execute(ctx *context.Context) error { cli := ctx.Module().DockerCli().ContainerExec(*s.ContainerId, s.Command) + if s.Detached { + cli.AddOption("--detach") + } out, err := cli.Execute(s.ExecOptions) return PostHandle(s.Success, s.Out, out, err, errno.ERR_RUN_COMMAND_IN_CONTAINER_FAILED.FD("(%s exec CONTAINER COMMAND)", s.ExecWithEngine)) } diff --git a/internal/task/task/bs/start_tgtd.go b/internal/task/task/bs/start_tgtd.go index fbd9ca462..0c2234405 100644 --- a/internal/task/task/bs/start_tgtd.go +++ b/internal/task/task/bs/start_tgtd.go @@ -127,7 +127,8 @@ func NewStartTargetDaemonTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig ExecOptions: curveadm.ExecOptions(), }) t.AddStep(&step.ContainerExec{ - Command: "tgtd -f &", + Command: "tgtd -f", + Detached: true, ContainerId: &containerId, ExecOptions: curveadm.ExecOptions(), })