- Fix a few bugs in external mount-bind integration

Upstream-commit: 67239957c9e863f16a6d147d88dd2fae00c3770f
Component: engine
This commit is contained in:
Gabriel Monroy
2013-06-26 15:10:38 -07:00
committed by Solomon Hykes
parent 1c5ea40b1c
commit 5327febeeb
2 changed files with 4 additions and 6 deletions
+1 -3
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
+3 -3
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}}