diff --git a/drivers/docker/handle.go b/drivers/docker/handle.go index 50042d0bb8f..4f144a14d63 100644 --- a/drivers/docker/handle.go +++ b/drivers/docker/handle.go @@ -95,7 +95,7 @@ func (h *taskHandle) Exec(ctx context.Context, cmd string, args []string) (*driv } exec, err := h.dockerClient.ContainerExecCreate(ctx, h.containerID, createExecOpts) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to create exec object: %v", err) } execResult := &drivers.ExecTaskResult{ExitResult: &drivers.ExitResult{}} @@ -110,12 +110,12 @@ func (h *taskHandle) Exec(ctx context.Context, cmd string, args []string) (*driv } // hijack exec output streams - hijacked, err := h.dockerClient.ContainerExecAttach(ctx, h.containerID, containerapi.ExecStartOptions{ + hijacked, err := h.dockerClient.ContainerExecAttach(ctx, exec.ID, containerapi.ExecStartOptions{ Detach: false, Tty: false, }) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to attach to exec: %v", err) } _, err = stdcopy.StdCopy(stdout, stderr, hijacked.Reader)