From 67239957c9e863f16a6d147d88dd2fae00c3770f Mon Sep 17 00:00:00 2001 From: Gabriel Monroy Date: Wed, 26 Jun 2013 15:43:53 +0000 Subject: [PATCH] - Fix a few bugs in external mount-bind integration --- container.go | 4 +--- lxc_template.go | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/container.go b/container.go index 64c4a80e3f..45bb728b96 100644 --- a/container.go +++ b/container.go @@ -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 diff --git a/lxc_template.go b/lxc_template.go index b3fed74d17..93b795e901 100644 --- a/lxc_template.go +++ b/lxc_template.go @@ -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}}