0

My Windows Container in Azure Container Instances does not seem to be able to access the internet.

enter image description here

What can I do to access the internet from my Windows Container?

halllo
  • 858
  • 12
  • 25

1 Answers1

0

I had to execute this PowerShell command in the container during startup:

Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter).IfIndex -ServerAddresses ('8.8.8.8')

Then my container was able to successfully resolve DNS and access the internet.

Executing this script in a RUN did not work, so I had to somehow execute it together with my already required CMD. I ended up doing it like this and it works:

CMD ["powershell", "-Command", "\"Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter).IfIndex -ServerAddresses ('8.8.8.8')\"; cd c:\\app; .\\my.exe ui"]

Don't forget to escape \ and ".

halllo
  • 858
  • 12
  • 25