execdrivers_linux.go 1020 B

1234567891011121314151617181920212223242526272829
  1. // +build linux
  2. package execdrivers
  3. import (
  4. "fmt"
  5. "path"
  6. "github.com/Sirupsen/logrus"
  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. // NewDriver returns a new execdriver.Driver from the given name configured with the provided options.
  13. func NewDriver(name string, options []string, root, libPath, 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. logrus.Warn("LXC built-in support is deprecated.")
  20. return lxc.NewDriver(root, libPath, initPath, sysInfo.AppArmor)
  21. case "native":
  22. return native.NewDriver(path.Join(root, "execdriver", "native"), initPath, options)
  23. }
  24. return nil, fmt.Errorf("unknown exec driver %s", name)
  25. }