From bfdf07ac98e1a425892b787cf224109d5925a798 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 25 Feb 2014 17:13:00 -0800 Subject: [PATCH] Return error for lxc-conf when using native driver Docker-DCO-1.1-Signed-off-by: Michael Crosby (github: crosbymichael) --- execdriver/native/driver.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/execdriver/native/driver.go b/execdriver/native/driver.go index 1460b09e87..ba7e8a719f 100644 --- a/execdriver/native/driver.go +++ b/execdriver/native/driver.go @@ -67,6 +67,9 @@ func NewDriver(root string) (*driver, error) { } func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) { + if err := d.validateCommand(c); err != nil { + return -1, err + } var ( term nsinit.Terminal container = createContainer(c) @@ -192,6 +195,17 @@ func (d *driver) removeContainerRoot(id string) error { return os.RemoveAll(filepath.Join(d.root, id)) } +func (d *driver) validateCommand(c *execdriver.Command) error { + // we need to check the Config of the command to make sure that we + // do not have any of the lxc-conf variables + for _, conf := range c.Config { + if strings.Contains(conf, "lxc") { + return fmt.Errorf("%s is not supported by the native driver", conf) + } + } + return nil +} + func getEnv(key string, env []string) string { for _, pair := range env { parts := strings.Split(pair, "=")