mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Enable DNS Lookups for CIFS Volumes
This comes from an old suggestion (https://github.com/docker/cli/issues/706#issuecomment-371157691) on an issue we were having and has since popped up again. For NFS volumes, Docker will do an IP lookup on the volume name. This is not done for CIFS volumes, which forces you to add the volume via IP address instead. This change will enable the IP lookup also for CIFS volumes. Signed-off-by: Shu-Wai Chow <shu-wai.chow@seattlechildrens.org>
This commit is contained in:
parent
12b837e474
commit
75a59c6588
1 changed files with 3 additions and 2 deletions
|
@ -97,11 +97,12 @@ func (v *localVolume) mount() error {
|
||||||
return fmt.Errorf("missing device in volume options")
|
return fmt.Errorf("missing device in volume options")
|
||||||
}
|
}
|
||||||
mountOpts := v.opts.MountOpts
|
mountOpts := v.opts.MountOpts
|
||||||
if v.opts.MountType == "nfs" {
|
switch v.opts.MountType {
|
||||||
|
case "nfs", "cifs":
|
||||||
if addrValue := getAddress(v.opts.MountOpts); addrValue != "" && net.ParseIP(addrValue).To4() == nil {
|
if addrValue := getAddress(v.opts.MountOpts); addrValue != "" && net.ParseIP(addrValue).To4() == nil {
|
||||||
ipAddr, err := net.ResolveIPAddr("ip", addrValue)
|
ipAddr, err := net.ResolveIPAddr("ip", addrValue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error resolving passed in nfs address")
|
return errors.Wrapf(err, "error resolving passed in network volume address")
|
||||||
}
|
}
|
||||||
mountOpts = strings.Replace(mountOpts, "addr="+addrValue, "addr="+ipAddr.String(), 1)
|
mountOpts = strings.Replace(mountOpts, "addr="+addrValue, "addr="+ipAddr.String(), 1)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue