github.com/daaku/docker@v1.5.0/daemon/execdriver/execdrivers/execdrivers.go (about)

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