I have created a build-pipeline which builds my docker based project. The image is being pushed to the Azure Container Registry.
What I want to achieve is to deploy the image to a virtual machine but I have no idea where to start. Do I for example need to create a release pipeline which executes a script on the virtual machine which results in the image being pulled and run?
Hope some can help me out with this one.
If you want to automate the process to deploy the image to a virtual machine via azure pipeline. You need to create a pipeline, or add an additional agent job or step which executes the dock commands on the virtual machine to your existing pipeline. Check out below possible workarounds:
1, Create a self-hosted agent on the virtual machine. See tutorial here for detailed steps.
Then you can add an additional agent job or create a release pipeline to run the docker commands in a script task. And configure the agent pool to run the job on your self-hosted agent pool.
For below example. I add an additional job and execute the docker commands in a powershell task to run the image:
2, If you donot want to create a self hosted agent. You can also try using one of below tasks in your pipeline, which allow you run the dock scripts on the target Virtual machine.
PowerShell on Target Machines task
SSH Deployment task