[英]Azure Container Instances no internet access for Windows Container?
I had to execute this PowerShell command in the container during startup: 在启动期间,我必须在容器中执行以下PowerShell命令:
Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter).IfIndex -ServerAddresses ('8.8.8.8')
Then my container was able to successfully resolve DNS and access the internet. 然后,我的容器能够成功解析DNS并访问Internet。
Executing this script in a RUN did not work, so I had to somehow execute it together with my already required CMD. 在RUN中执行此脚本无效,因此我不得不以某种方式与已经需要的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 "
. 不要忘记
\\
和"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.