From 32685e9c2bff044dc8cc61187448dbab7be50900 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 3 Apr 2019 01:36:33 +0000 Subject: [PATCH] daemon/mountVolumes(): eliminate MakeRPrivate call It is sufficient to add "rprivate" to mount flags. Signed-off-by: Kir Kolyshkin (cherry picked from commit a6773f69f26bf93a5183e41f66c1d36817c5b768) Signed-off-by: Sebastiaan van Stijn --- daemon/volumes_unix.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/daemon/volumes_unix.go b/daemon/volumes_unix.go index 13e0a90194..3f4c5ffda1 100644 --- a/daemon/volumes_unix.go +++ b/daemon/volumes_unix.go @@ -141,10 +141,6 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error { if m.Writable { writeMode = "rw" } - opts := strings.Join([]string{bindMode, writeMode}, ",") - if err := mount.Mount(m.Source, dest, "", opts); err != nil { - return err - } // mountVolumes() seems to be called for temporary mounts // outside the container. Soon these will be unmounted with @@ -154,8 +150,9 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error { // then these unmounts will propagate and unmount original // mount as well. So make all these mounts rprivate. // Do not use propagation property of volume as that should - // apply only when mounting happen inside the container. - if err := mount.MakeRPrivate(dest); err != nil { + // apply only when mounting happens inside the container. + opts := strings.Join([]string{bindMode, writeMode, "rprivate"}, ",") + if err := mount.Mount(m.Source, dest, "", opts); err != nil { return err } }