github.com/fcwu/docker@v1.4.2-0.20150115145920-2a69ca89f0df/daemon/execdriver/execdrivers/execdrivers.go (about)

     1  package execdrivers
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/docker/docker/daemon/execdriver"
     6  	"github.com/docker/docker/daemon/execdriver/lxc"
     7  	"github.com/docker/docker/daemon/execdriver/native"
     8  	"github.com/docker/docker/pkg/sysinfo"
     9  	"path"
    10  )
    11  
    12  func NewDriver(name, root, initPath string, sysInfo *sysinfo.SysInfo) (execdriver.Driver, error) {
    13  	switch name {
    14  	case "lxc":
    15  		// we want to give the lxc driver the full docker root because it needs
    16  		// to access and write config and template files in /var/lib/docker/containers/*
    17  		// to be backwards compatible
    18  		return lxc.NewDriver(root, initPath, sysInfo.AppArmor)
    19  	case "native":
    20  		return native.NewDriver(path.Join(root, "execdriver", "native"), initPath)
    21  	}
    22  	return nil, fmt.Errorf("unknown exec driver %s", name)
    23  }