Return error for lxc-conf when using native driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
5c67d2e634
commit
bfdf07ac98
|
@ -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) {
|
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 (
|
var (
|
||||||
term nsinit.Terminal
|
term nsinit.Terminal
|
||||||
container = createContainer(c)
|
container = createContainer(c)
|
||||||
|
@ -192,6 +195,17 @@ func (d *driver) removeContainerRoot(id string) error {
|
||||||
return os.RemoveAll(filepath.Join(d.root, id))
|
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 {
|
func getEnv(key string, env []string) string {
|
||||||
for _, pair := range env {
|
for _, pair := range env {
|
||||||
parts := strings.Split(pair, "=")
|
parts := strings.Split(pair, "=")
|
||||||
|
|
Loading…
Reference in New Issue