ip-addressazure-container-instances

IP address is not available anymore after updating a container instance


I just try to update my existing container instance image using this command :

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

and it works fine, the image was updated, So I stopped the container instance manually then start it manually.

After starting the container instance the IP address disappear I don't know why while the status is Running.

Can you help me with that ?


Solution

  • To ensure IP address is available post update, use the --ip-address parameter in your existing command:

    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>
    
    

    Output:

    enter image description here

    enter image description here

    enter image description here

    Similarly, if you want to add additional parameters, for example how much CPU, Memory, port or any additional environment variables, you can add them accordingly, example-

    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
    
    

    If your current ACI is not showing the IP address, then kindly check the JSON view for the ACI there should be IP Address section, Check if that is empty?

    enter image description here

    Reference Document:

    Azure Container Instance Documentaion

    SonarQube upgrade on ACI

    Deploy SonarQube on ACI