diff --git a/daemon/execdriver/windows/exec.go b/daemon/execdriver/windows/exec.go index 241997e2ff..85fda473a8 100644 --- a/daemon/execdriver/windows/exec.go +++ b/daemon/execdriver/windows/exec.go @@ -51,8 +51,15 @@ func (d *Driver) Exec(c *execdriver.Command, processConfig *execdriver.ProcessCo logrus.Debugln("commandLine: ", createProcessParms.CommandLine) // Start the command running in the container. - pid, stdin, stdout, stderr, err := hcsshim.CreateProcessInComputeSystem(c.ID, pipes.Stdin != nil, true, !processConfig.Tty, createProcessParms) + pid, stdin, stdout, stderr, rc, err := hcsshim.CreateProcessInComputeSystem(c.ID, pipes.Stdin != nil, true, !processConfig.Tty, createProcessParms) if err != nil { + // TODO Windows: TP4 Workaround. In Hyper-V containers, there is a limitation + // of one exec per container. This should be fixed post TP4. CreateProcessInComputeSystem + // will return a specific error which we handle here to give a good error message + // back to the user instead of an inactionable "An invalid argument was supplied" + if rc == hcsshim.Win32InvalidArgument { + return -1, fmt.Errorf("The limit of docker execs per Hyper-V container has been exceeded") + } logrus.Errorf("CreateProcessInComputeSystem() failed %s", err) return -1, err } diff --git a/daemon/execdriver/windows/run.go b/daemon/execdriver/windows/run.go index 98d8d1c921..7d03061855 100644 --- a/daemon/execdriver/windows/run.go +++ b/daemon/execdriver/windows/run.go @@ -263,7 +263,7 @@ func (d *Driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, hooks execd logrus.Debugf("CommandLine: %s", createProcessParms.CommandLine) // Start the command running in the container. - pid, stdin, stdout, stderr, err := hcsshim.CreateProcessInComputeSystem(c.ID, pipes.Stdin != nil, true, !c.ProcessConfig.Tty, createProcessParms) + pid, stdin, stdout, stderr, _, err := hcsshim.CreateProcessInComputeSystem(c.ID, pipes.Stdin != nil, true, !c.ProcessConfig.Tty, createProcessParms) if err != nil { logrus.Errorf("CreateProcessInComputeSystem() failed %s", err) return execdriver.ExitStatus{ExitCode: -1}, err