BCDevOps/issues-and-solutions

Port Redirects not binding to IPv4 Interface: s2i-aspnet-example failing + workaround

Closed this issue · 1 comments

Discovered this issue by following the instructions to build the s2i-aspnet-example package, and not being able to run the application. I was could see the app was failing with the Exception error Microsoft.AspNetCore.Server.Kestrel.Networking.UvException: Error -97 EAFNOSUPPORT address family not supported

Initially I found nothing related to Openshift, but did did come across people reporting Kestrel issues related to loop back (and other types of?) redirects not binding to IPv4. The workaround was an interesting way to tell Kestrel or the application to bind to the IPv4 by specifying the address/port as 0.0.0.0:5000. I did this by cloning the git repo and editing Program.cs to add the highlighted line:

var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup()
.UseConfiguration(config)
.UseUrls("http://0.0.0.0:5000")
.Build();

I do not consider this the permanent fix, as it would have to be applied to each app. It looks like both the OS in the docker container and Kestrel can be instructed to ensure binding & forwarding is occurring on IPv4, but these are baked into the s2i base image which I'm not prepared to unpack right now. I've made them aware of my experience

I later came across this issue in the docker github repo, so it doesn't look unique to Kestrel or .Net Core apps moby/moby#2174

@ckayfish, I am hoping this issue has been resolved with our most recent OpenShift (3.11)