【发布时间】:2019-07-19 17:20:17
【问题描述】:
【问题讨论】:
标签: azure azure-container-instances
【问题讨论】:
标签: azure azure-container-instances
我必须在启动期间在容器中执行这个 PowerShell 命令:
Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter).IfIndex -ServerAddresses ('8.8.8.8')
然后我的容器能够成功解析 DNS 并访问互联网。
在 RUN 中执行此脚本不起作用,所以我不得不以某种方式将它与我已经需要的 CMD 一起执行。我最终这样做了,它可以工作:
CMD ["powershell", "-Command", "\"Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter).IfIndex -ServerAddresses ('8.8.8.8')\"; cd c:\\app; .\\my.exe ui"]
别忘了转义\ 和"。
【讨论】: