更新容器实例后IP地址不再可用

问题描述 投票:0回答:1

我只是尝试使用此命令更新现有的容器实例映像:

 az container create -g ressourcegroup --name sonar --image sonarqube:8.9-community --ports 9000 --location eastus --cpu 2 --memory 3.5

它工作正常,图像已更新,所以我手动停止容器实例,然后手动启动它。

启动容器实例后,当状态为“正在运行”时,IP 地址消失,我不知道为什么。

你能帮我吗?

ip-address azure-container-instances
1个回答
0
投票

要确保 IP 地址在更新后可用,请在现有命令中使用

--ip-address
参数:

az container create -g ressourcegroup --name sonarqube --image sonarqube:8.9-community --ports 9000 --location eastus --cpu 2 --memory 3.5 --ip-address <Public/Private>

输出:

enter image description here

enter image description here

enter image description here

同样,如果您想添加其他参数,例如多少CPU,内存,端口或任何其他环境变量,您可以相应地添加它们,例如-

az container create --<resource-group>  \  
--location <yourLocation> --name <ACIName> \  
--cpu <value> --memory <value> \  
--image sonarqube:8.9-community \  
--os-type Linux --ip-address Public \  
--environment-variables\  
'SONARQUBE_JDBC_USERNAME'='sonar' \  
'SONARQUBE_JDBC_PASSWORD'='<your password>' \  
'SONARQUBE_JDBC_URL'='jdbc:sqlserver://srv-sql-sonarqube.database.windows.net:1433;database=sonarqubeDb;user=sonar@srv-sql-sonarqube;password=<your password>;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30'\  
--ports 9000 \  
--protocol TCP

如果您当前的 ACI 未显示 IP 地址,请检查 ACI 的 JSON 视图,其中应该有 IP 地址部分,检查是否为空?

enter image description here

参考文档:

Azure 容器实例文档

ACI 上的 SonarQube 升级

在 ACI 上部署 SonarQube

© www.soinside.com 2019 - 2024. All rights reserved.