mount of /.dockerinit is not needed for native driver, so move it into lxc driver

Docker-DCO-1.1-Signed-off-by: Albert Zhang <zhgwenming@gmail.com> (github: zhgwenming)
This commit is contained in:
Albert Zhang 2014-06-03 15:46:01 +08:00
parent bc33ce0d8f
commit b611198d28
3 changed files with 5 additions and 3 deletions

View file

@ -15,7 +15,7 @@ func NewDriver(name, root, initPath string, sysInfo *sysinfo.SysInfo) (execdrive
// we want to give the lxc driver the full docker root because it needs
// to access and write config and template files in /var/lib/docker/containers/*
// to be backwards compatible
return lxc.NewDriver(root, sysInfo.AppArmor)
return lxc.NewDriver(root, initPath, sysInfo.AppArmor)
case "native":
return native.NewDriver(path.Join(root, "execdriver", "native"), initPath)
}

View file

@ -54,11 +54,12 @@ func init() {
type driver struct {
root string // root path for the driver to use
initPath string
apparmor bool
sharedRoot bool
}
func NewDriver(root string, apparmor bool) (*driver, error) {
func NewDriver(root, initPath string, apparmor bool) (*driver, error) {
// setup unconfined symlink
if err := linkLxcStart(root); err != nil {
return nil, err
@ -66,6 +67,7 @@ func NewDriver(root string, apparmor bool) (*driver, error) {
return &driver{
apparmor: apparmor,
root: root,
initPath: initPath,
sharedRoot: rootIsShared(),
}, nil
}
@ -79,6 +81,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
if err := execdriver.SetTerminal(c, pipes); err != nil {
return -1, err
}
c.Mounts = append(c.Mounts, execdriver.Mount{d.initPath, c.InitPath, false, true})
if err := d.generateEnvConfig(c); err != nil {
return -1, err
}

View file

@ -36,7 +36,6 @@ func prepareVolumesForContainer(container *Container) error {
func setupMountsForContainer(container *Container) error {
mounts := []execdriver.Mount{
{container.daemon.sysInitPath, "/.dockerinit", false, true},
{container.ResolvConfPath, "/etc/resolv.conf", false, true},
}