github.com/circular-dark/docker@v1.7.0/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/docker/docker/daemon/execdriver"
    10  	"github.com/docker/docker/daemon/execdriver/lxc"
    11  	"github.com/docker/docker/daemon/execdriver/native"
    12  	"github.com/docker/docker/pkg/sysinfo"
    13  )
    14  
    15  func NewDriver(name string, options []string, root, libPath, initPath string, sysInfo *sysinfo.SysInfo) (execdriver.Driver, error) {
    16  	switch name {
    17  	case "lxc":
    18  		// we want to give the lxc driver the full docker root because it needs
    19  		// to access and write config and template files in /var/lib/docker/containers/*
    20  		// to be backwards compatible
    21  		return lxc.NewDriver(root, libPath, initPath, sysInfo.AppArmor)
    22  	case "native":
    23  		return native.NewDriver(path.Join(root, "execdriver", "native"), initPath, options)
    24  	}
    25  	return nil, fmt.Errorf("unknown exec driver %s", name)
    26  }