execdrivers.go 764 B

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