'Azure Devops Deploy Docker image to ec2 instance
I hope somebody can direct to the best approach to solve this matter.
I have an azure account on which I have an azure container registry holding my docker images. Just for personal education purpose I want to try and deploy one of azure docker images into a aws ec2 instance.
Reading some aws documentation, I understand that I need to create a ecr
container and with azure DevOps, using the service connection
to build and deploy the docker images to ecr
, this seems to be pretty straight forward. But after this step its plain darkness as I cannot find a best approach on how to implement a continuous delivery every time there is a new docker image in my ecr.
One of the solutions I thought and found, is to install an azure DevOps agent on the ec2 to run a docker pull
but I am not 100% sure about if this is the best approach.
So I am asking to you experts to enlighten me about this and I do apology for the basic question.
Thank you so much in advance for any help you can provide, and please if my question is not 100% clear, do not hesitate to ask more infos.
Solution 1:[1]
You should be able to authenticate to your Azure Container Registry instance from EC2 using standard docker login
command. You do not even need Azure DevOps agent for that, since you should be able to configure regular service principal with set of standard docker registry credentials.
Then you can pull and use your images normally.
It is absolutely not required to replicate your images in the ECR.
Solution 2:[2]
Unless you want to do full ECS. Use a shell script to do what you would do manually on the EC2 command line.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | taleodor |
Solution 2 | Robert |