Browse code

Merge pull request #23947 from cpuguy83/fix_mount_target

Volume mounts need to use "Binds" API field

Sebastiaan van Stijn authored on 2016/07/02 05:23:14
Showing 1 changed files
... ...
@@ -91,13 +91,12 @@ func (c *containerConfig) image() string {
91 91
 func (c *containerConfig) volumes() map[string]struct{} {
92 92
 	r := make(map[string]struct{})
93 93
 
94
-	for _, mount := range c.spec().Mounts {
94
+	for _, m := range c.spec().Mounts {
95 95
 		// pick off all the volume mounts.
96
-		if mount.Type != api.MountTypeVolume {
96
+		if m.Type != api.MountTypeVolume || m.Source != "" {
97 97
 			continue
98 98
 		}
99
-
100
-		r[fmt.Sprintf("%s:%s", mount.Target, getMountMask(&mount))] = struct{}{}
99
+		r[m.Target] = struct{}{}
101 100
 	}
102 101
 
103 102
 	return r
... ...
@@ -165,7 +164,7 @@ func (c *containerConfig) bindMounts() []string {
165 165
 
166 166
 	for _, val := range c.spec().Mounts {
167 167
 		mask := getMountMask(&val)
168
-		if val.Type == api.MountTypeBind {
168
+		if val.Type == api.MountTypeBind || (val.Type == api.MountTypeVolume && val.Source != "") {
169 169
 			r = append(r, fmt.Sprintf("%s:%s:%s", val.Source, val.Target, mask))
170 170
 		}
171 171
 	}