Docker Community Forums

Share and learn in the Docker community.

System.Net.Sockets.SocketException: No such host is known

I am newbie to docker, I have Docker Server on Windows Server 2019. Created image of an core application. Successfully started the container. When accessing the website,the web Applications make a service call to a corporate internal host and its not able to resolve in the docker container. Getting Error:
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
Caused by: System.Net.Sockets.SocketException: No such host is known.
at System.Net.Dns.InternalGetHostByName(String hostName)
at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
at IceInternal.Network.getAddresses(String host, Int32 port, Int32 protocol, Boolean blocking)
fail: Microsoft.AspNetCore.Server.Kestrel[13]

Some of things I tried:
add-hosts during docker run
entry into C:\Windows\System32\drivers\etc

Any help is greatly appreciated. thanks.

Answering my own question: creating daemon.json file in C:\ProgramData\docker\config and adding DNS ad DNSSearch resolved the hostname