Search code examples
azure-container-serviceazure-container-instances

Azure Container Instance Can't Connect to Internet (outbound http GET request failed)


I have an Azure Container Instance created from the base image microsoft/windowsservercore:ltsc2016. The image has mercurial installed and checks out a private repo using hg clone but fails with the result abort: error: getaddrinfo failed. When run on my workstation using Docker for Windows, the container successfully checks out the repo.

I believe this is a network connectivity issue, because if I run powershell Invoke-WebRequest http://microsoft.com the container also logs an error that the request could not be completed due to failure to connect to the server.


Solution

  • The Windows container on ACI has a known issue about the out-bound network. It is suggested to add a retry logic on any network request or add a 30 seconds' delay before you start your application.

    https://learn.microsoft.com/en-us/azure/container-instances/container-instances-troubleshooting#windows-containers-slow-network-readiness

    The issue only impacts the Windows Server 2016. It is fixed in Windows Server 2019. Once ACI adapts WS2019, the workaround will be no longer needed.