Allow mounts to be supplied with the MS_SLAVE option.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
This commit is contained in:
Erik Hollensbe 2014-09-03 19:37:48 -07:00
parent 395d842ab4
commit 73db17b4d7
1 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,7 @@ type Mount struct {
Writable bool `json:"writable,omitempty"`
Relabel string `json:"relabel,omitempty"` // Relabel source if set, "z" indicates shared, "Z" indicates unshared
Private bool `json:"private,omitempty"`
Slave bool `json:"slave,omitempty"`
}
func (m *Mount) Mount(rootfs, mountLabel string) error {
@ -40,6 +41,10 @@ func (m *Mount) bindMount(rootfs, mountLabel string) error {
flags = flags | syscall.MS_RDONLY
}
if m.Slave {
flags = flags | syscall.MS_SLAVE
}
stat, err := os.Stat(m.Source)
if err != nil {
return err