diff --git a/daemon/volumes.go b/daemon/volumes.go index a2cf3af33a..46ae5588af 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -15,6 +15,7 @@ import ( "github.com/docker/docker/pkg/chrootarchive" "github.com/docker/docker/pkg/symlink" "github.com/docker/docker/volumes" + "github.com/docker/libcontainer/label" ) type Mount struct { @@ -247,6 +248,12 @@ func (container *Container) setupMounts() error { 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 + } + } + // Mount user specified volumes // Note, these are not private because you may want propagation of (un)mounts from host // volumes. For instance if you use -v /usr:/usr and the host later mounts /usr/share you