3

I want to deploy a image from docker hub to Azure Container Instance.How can we do this.Is it mandatory to push the image first to Azure Container Registry?

All solutions I am getting shows that we need to push the image first to Azure Container Registry.

2 Answers 2

4

No, you need not push the image to ACR first, just let the image stay in the docker hub. For example, deploy the Nginx docker image to ACI, the Azure CLI command like below:

az container create -g resourceGroup -n aciName --image nginx --ports 80

As the command shows, you can use the docker image. Actually, the docker hub is the default registry. When you use another registry, you need to add the parameters --registry-login-server, --registry-username and --registry-password. For more details, see az container create.

It also shows clearly in the Azure portal, when you create ACI in the portal, you can see it like below:

enter image description here

Sign up to request clarification or add additional context in comments.

5 Comments

thanks for the answer,I have done the same chose private registry and then it asked fro the docker hub credentials and my image was deployed.
@AKANKSHAKUSHWAHA As the screenshot shows, if you choose the public image, it does not need the credential. But if you use a private docker hub image, it also needs the credential. The image has the type for public and private.
yes ,as the registry from where i was supposed to pull the image was a private docker hub registry.
.hey now my image is deployed but i am not able to access the application .the generated FQDN gives no response.Do i need to do some extra configuration to expose the API so that i can hit it from postman or browser
@AKANKSHAKUSHWAHA It just like you run the image locally. You need to expose the port which you listen inside the container. And you need first make sure the image can run well locally.
0

You can use docker image directly with the container as follows,

az container create --resource-group myResourceGroup --name mycontainer --image docker image url  

1 Comment

hey now my image is deployed but i am not able to access the application .the generated FQDN gives no response.Do i need to do some extra configuration to expose the API so that i can hit it from postman or browser

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.