code: func validateNetworkingConfig(n libnetwork.Network, epConfig *networktypes.EndpointSettings) error {
  	if n == nil || epConfig == nil {
  		return nil
  	}
  	if !containertypes.NetworkMode(n.Name()).IsUserDefined() {
  		if hasUserDefinedIPAddress(epConfig.IPAMConfig) && !enableIPOnPredefinedNetwork() {
  			return runconfig.ErrUnsupportedNetworkAndIP
  		}
  		if len(epConfig.Aliases) > 0 && !serviceDiscoveryOnDefaultNetwork() {
  			return runconfig.ErrUnsupportedNetworkAndAlias
  		}
  	}
  	if !hasUserDefinedIPAddress(epConfig.IPAMConfig) {
  		return nil
  	}
  
  	_, _, nwIPv4Configs, nwIPv6Configs := n.Info().IpamConfig()
  	for _, s := range []struct {
  		ipConfigured  bool
  		subnetConfigs []*libnetwork.IpamConf
  	}{
  		{
  			ipConfigured:  len(epConfig.IPAMConfig.IPv4Address) > 0,
  			subnetConfigs: nwIPv4Configs,
  		},
  		{
  			ipConfigured:  len(epConfig.IPAMConfig.IPv6Address) > 0,
  			subnetConfigs: nwIPv6Configs,
  		},
  	} {
  		if s.ipConfigured {
  			foundSubnet := false
  			for _, cfg := range s.subnetConfigs {
  				if len(cfg.PreferredPool) > 0 {
  					foundSubnet = true
  					break
  				}
  			}
  			if !foundSubnet {
  				return runconfig.ErrUnsupportedNetworkNoSubnetAndIP
  			}
  		}
  	}
  
  	return nil
  }
docs: // User specified ip address is acceptable only for networks with user specified subnets.