mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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:
parent
bc33ce0d8f
commit
b611198d28
3 changed files with 5 additions and 3 deletions
|
@ -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
|
// 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 access and write config and template files in /var/lib/docker/containers/*
|
||||||
// to be backwards compatible
|
// to be backwards compatible
|
||||||
return lxc.NewDriver(root, sysInfo.AppArmor)
|
return lxc.NewDriver(root, initPath, sysInfo.AppArmor)
|
||||||
case "native":
|
case "native":
|
||||||
return native.NewDriver(path.Join(root, "execdriver", "native"), initPath)
|
return native.NewDriver(path.Join(root, "execdriver", "native"), initPath)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,12 @@ func init() {
|
||||||
|
|
||||||
type driver struct {
|
type driver struct {
|
||||||
root string // root path for the driver to use
|
root string // root path for the driver to use
|
||||||
|
initPath string
|
||||||
apparmor bool
|
apparmor bool
|
||||||
sharedRoot bool
|
sharedRoot bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDriver(root string, apparmor bool) (*driver, error) {
|
func NewDriver(root, initPath string, apparmor bool) (*driver, error) {
|
||||||
// setup unconfined symlink
|
// setup unconfined symlink
|
||||||
if err := linkLxcStart(root); err != nil {
|
if err := linkLxcStart(root); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -66,6 +67,7 @@ func NewDriver(root string, apparmor bool) (*driver, error) {
|
||||||
return &driver{
|
return &driver{
|
||||||
apparmor: apparmor,
|
apparmor: apparmor,
|
||||||
root: root,
|
root: root,
|
||||||
|
initPath: initPath,
|
||||||
sharedRoot: rootIsShared(),
|
sharedRoot: rootIsShared(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -79,6 +81,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
||||||
if err := execdriver.SetTerminal(c, pipes); err != nil {
|
if err := execdriver.SetTerminal(c, pipes); err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
c.Mounts = append(c.Mounts, execdriver.Mount{d.initPath, c.InitPath, false, true})
|
||||||
if err := d.generateEnvConfig(c); err != nil {
|
if err := d.generateEnvConfig(c); err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ func prepareVolumesForContainer(container *Container) error {
|
||||||
|
|
||||||
func setupMountsForContainer(container *Container) error {
|
func setupMountsForContainer(container *Container) error {
|
||||||
mounts := []execdriver.Mount{
|
mounts := []execdriver.Mount{
|
||||||
{container.daemon.sysInitPath, "/.dockerinit", false, true},
|
|
||||||
{container.ResolvConfPath, "/etc/resolv.conf", false, true},
|
{container.ResolvConfPath, "/etc/resolv.conf", false, true},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue