1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Label standard mounts within loop

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2014-12-01 14:54:14 -05:00
parent 61b2766e75
commit 305e9cd2fa

View file

@ -236,25 +236,22 @@ func validMountMode(mode string) bool {
} }
func (container *Container) setupMounts() error { func (container *Container) setupMounts() error {
if err := label.SetFileLabel(container.ResolvConfPath, container.MountLabel); err != nil {
return err
}
mounts := []execdriver.Mount{ mounts := []execdriver.Mount{
{Source: container.ResolvConfPath, Destination: "/etc/resolv.conf", Writable: true, Private: true}, {Source: container.ResolvConfPath, Destination: "/etc/resolv.conf", Writable: true, Private: true},
} }
if container.HostnamePath != "" { if container.HostnamePath != "" {
if err := label.SetFileLabel(container.HostnamePath, container.MountLabel); err != nil {
return err
}
mounts = append(mounts, execdriver.Mount{Source: container.HostnamePath, Destination: "/etc/hostname", Writable: true, Private: true}) mounts = append(mounts, execdriver.Mount{Source: container.HostnamePath, Destination: "/etc/hostname", Writable: true, Private: true})
} }
if container.HostsPath != "" { if container.HostsPath != "" {
if err := label.SetFileLabel(container.HostsPath, container.MountLabel); err != nil { mounts = append(mounts, execdriver.Mount{Source: container.HostsPath, Destination: "/etc/hosts", Writable: true, Private: true})
}
for _, m := range mounts {
if err := label.SetFileLabel(m.Source, container.MountLabel); err != nil {
return err return err
} }
mounts = append(mounts, execdriver.Mount{Source: container.HostsPath, Destination: "/etc/hosts", Writable: true, Private: true})
} }
// Mount user specified volumes // Mount user specified volumes