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:
parent
395d842ab4
commit
73db17b4d7
|
@ -17,6 +17,7 @@ type Mount struct {
|
||||||
Writable bool `json:"writable,omitempty"`
|
Writable bool `json:"writable,omitempty"`
|
||||||
Relabel string `json:"relabel,omitempty"` // Relabel source if set, "z" indicates shared, "Z" indicates unshared
|
Relabel string `json:"relabel,omitempty"` // Relabel source if set, "z" indicates shared, "Z" indicates unshared
|
||||||
Private bool `json:"private,omitempty"`
|
Private bool `json:"private,omitempty"`
|
||||||
|
Slave bool `json:"slave,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Mount) Mount(rootfs, mountLabel string) error {
|
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
|
flags = flags | syscall.MS_RDONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.Slave {
|
||||||
|
flags = flags | syscall.MS_SLAVE
|
||||||
|
}
|
||||||
|
|
||||||
stat, err := os.Stat(m.Source)
|
stat, err := os.Stat(m.Source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue