瀏覽代碼

use bind API for bind mounts

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 9 月之前
父節點
當前提交
c83f1285a8
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      pkg/compose/create.go

+ 5 - 4
pkg/compose/create.go

@@ -862,11 +862,12 @@ func (s *composeService) buildContainerVolumes(
 					v.Source = m.Source
 					fallthrough
 				case !requireMountAPI(v.Bind):
-					vol := findVolumeByName(p.Volumes, m.Source)
-					if vol != nil {
-						binds = append(binds, toBindString(vol.Name, v))
-						continue
+					source := m.Source
+					if vol := findVolumeByName(p.Volumes, m.Source); vol != nil {
+						source = m.Source
 					}
+					binds = append(binds, toBindString(source, v))
+					continue
 				}
 			}
 		case mount.TypeVolume: