- Fix a few bugs in external mount-bind integration

This commit is contained in:
Gabriel Monroy 2013-06-26 15:43:53 +00:00 committed by Solomon Hykes
parent d4e62101ab
commit 67239957c9
2 changed files with 4 additions and 6 deletions

View File

@ -145,11 +145,10 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
}
// add any bind targets to the list of container volumes
type empty struct{}
for _, bind := range flBinds {
arr := strings.Split(bind, ":")
dstDir := arr[1]
flVolumes[dstDir] = empty{}
flVolumes[dstDir] = struct{}{}
}
parsedArgs := cmd.Args()
@ -564,7 +563,6 @@ func (container *Container) Start(hostConfig *HostConfig) error {
container.Volumes[volPath] = id
}
}
container.VolumesRW = make(map[string]bool)
if err := container.generateLXCConfig(); err != nil {
return err

View File

@ -84,9 +84,9 @@ lxc.mount.entry = {{.SysInitPath}} {{$ROOTFS}}/sbin/init none bind,ro 0 0
# In order to get a working DNS environment, mount bind (ro) the host's /etc/resolv.conf into the container
lxc.mount.entry = {{.ResolvConfPath}} {{$ROOTFS}}/etc/resolv.conf none bind,ro 0 0
{{if .Volumes}}
+{{ $rw := .VolumesRW }}
+{{range $virtualPath, $realPath := .Volumes}}
+lxc.mount.entry = {{$realPath}} {{$ROOTFS}}/{{$virtualPath}} none bind,{{ if index $rw $virtualPath }}rw{{else}}ro{{end}} 0 0
{{ $rw := .VolumesRW }}
{{range $virtualPath, $realPath := .Volumes}}
lxc.mount.entry = {{$realPath}} {{$ROOTFS}}/{{$virtualPath}} none bind,{{ if index $rw $virtualPath }}rw{{else}}ro{{end}} 0 0
{{end}}
{{end}}