1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #23947 from cpuguy83/fix_mount_target

Volume mounts need to use "Binds" API field
This commit is contained in:
Sebastiaan van Stijn 2016-07-01 13:23:14 -07:00 committed by GitHub
commit adb48487f2

View file

@ -91,13 +91,12 @@ func (c *containerConfig) image() string {
func (c *containerConfig) volumes() map[string]struct{} { func (c *containerConfig) volumes() map[string]struct{} {
r := make(map[string]struct{}) r := make(map[string]struct{})
for _, mount := range c.spec().Mounts { for _, m := range c.spec().Mounts {
// pick off all the volume mounts. // pick off all the volume mounts.
if mount.Type != api.MountTypeVolume { if m.Type != api.MountTypeVolume || m.Source != "" {
continue continue
} }
r[m.Target] = struct{}{}
r[fmt.Sprintf("%s:%s", mount.Target, getMountMask(&mount))] = struct{}{}
} }
return r return r
@ -165,7 +164,7 @@ func (c *containerConfig) bindMounts() []string {
for _, val := range c.spec().Mounts { for _, val := range c.spec().Mounts {
mask := getMountMask(&val) mask := getMountMask(&val)
if val.Type == api.MountTypeBind { if val.Type == api.MountTypeBind || (val.Type == api.MountTypeVolume && val.Source != "") {
r = append(r, fmt.Sprintf("%s:%s:%s", val.Source, val.Target, mask)) r = append(r, fmt.Sprintf("%s:%s:%s", val.Source, val.Target, mask))
} }
} }