github.com/tompao/docker@v1.9.1/daemon/execdriver/execdrivers/execdrivers_linux.go (about)

     1  // +build linux
     2  
     3  package execdrivers
     4  
     5  import (
     6  	"fmt"
     7  	"path"
     8  
     9  	"github.com/Sirupsen/logrus"
    10  	"github.com/docker/docker/daemon/execdriver"
    11  	"github.com/docker/docker/daemon/execdriver/lxc"
    12  	"github.com/docker/docker/daemon/execdriver/native"
    13  	"github.com/docker/docker/pkg/sysinfo"
    14  )
    15  
    16  // NewDriver returns a new execdriver.Driver from the given name configured with the provided options.
    17  func NewDriver(name string, options []string, root, libPath, initPath string, sysInfo *sysinfo.SysInfo) (execdriver.Driver, error) {
    18  	switch name {
    19  	case "lxc":
    20  		// we want to give the lxc driver the full docker root because it needs
    21  		// to access and write config and template files in /var/lib/docker/containers/*
    22  		// to be backwards compatible
    23  		logrus.Warn("LXC built-in support is deprecated.")
    24  		return lxc.NewDriver(root, libPath, initPath, sysInfo.AppArmor)
    25  	case "native":
    26  		return native.NewDriver(path.Join(root, "execdriver", "native"), initPath, options)
    27  	}
    28  	return nil, fmt.Errorf("unknown exec driver %s", name)
    29  }