Windows: Split ContainerExecCreate

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
jhowardmsft 2015-04-24 11:12:56 -07:00 committed by John Howard
parent 56c9917815
commit e35b025aa6
3 changed files with 30 additions and 3 deletions

View File

@ -9,7 +9,6 @@ import (
"github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/execdriver/lxc"
"github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/stringid"
@ -111,8 +110,9 @@ func (d *Daemon) getActiveContainer(name string) (*Container, error) {
func (d *Daemon) ContainerExecCreate(config *runconfig.ExecConfig) (string, error) {
if strings.HasPrefix(d.execDriver.Name(), lxc.DriverName) {
return "", lxc.ErrExec
// Not all drivers support Exec (LXC for example)
if err := checkExecSupport(d.execDriver.Name()); err != nil {
return "", err
}
container, err := d.getActiveContainer(config.Container)

18
daemon/exec_linux.go Normal file
View File

@ -0,0 +1,18 @@
// +build linux
package daemon
import (
"strings"
"github.com/docker/docker/daemon/execdriver/lxc"
)
// checkExecSupport returns an error if the exec driver does not support exec,
// or nil if it is supported.
func checkExecSupport(drivername string) error {
if strings.HasPrefix(drivername, lxc.DriverName) {
return lxc.ErrExec
}
return nil
}

9
daemon/exec_windows.go Normal file
View File

@ -0,0 +1,9 @@
// +build windows
package daemon
// checkExecSupport returns an error if the exec driver does not support exec,
// or nil if it is supported.
func checkExecSupport(DriverName string) error {
return nil
}