I want to automate the process of pulling docker images from Azure container Registry to the Azure VM. I have already done the following:
- Created an Azure container Registry.
- Setup username and password in the Azure Container Registry.
- Pushed the image from my local machine to the Container Registry.
I have setup up terraform code to automate the build out of Azure VM. I also want to include the docker pull and docker run commands so that those tasks are automated. Below are the commands I would like to automate into terraform:
sudo docker login --username xxx --password xxx xxx.azurecr.io
sudo docker pull xxx.azurecr.io/xx/xxx
sudo docker run --network=host xxx.azurecr.io/xxx/xxx
Any help would be much appreciated. Thank you folks!