execdrivers_linux.go 834 B

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