Running a Linux VSTS Agent on Azure Container Instances

About 3 weeks ago, Corey Sanders (https://azure.microsoft.com/en-us/blog/announcing-azure-container-instances/) announced in his blog that Azure Container Instances is in private preview. I think that this new Azure service is very promising. In a nutshell, it is a hosted and managed Container cluster. The only thing you need to take care of is to create a container image and make it available in some container registry.

Running a VSTS agent

As a Microsoft guy that needs to use linux more and more, I am always looking at easy ways to use linux but not needing to master it. I blogged earlier about running VSTS agents on Linux (here and here) so I thought to take it a step further.

I started out with visiting the official Docker Hub page with the VSTS Agents. The challenge, use this standard Docker image and run it on Container Instances

Using the documentation from Microsoft Docs, I was able to run a container. Currently only the Azure CLI is supported and the client version is not yet updated.

So I moved to the Azure Portal and opened the CLI. First I created a resources group and then the container instance. It is perfect, the only things you need is to run these 2 commands

az group create --name <resourcegroup> --location westeurope

az container create 
--name vsts-agent 
--image microsoft/vsts-agent 
--resource-group <resourcegroup>
--environment-variables VSTS_ACCOUNT=<vstsaccountname> 
VSTS_TOKEN=<PAT> VSTS_AGENT=<Agent-Name>

ci

Then it creates an Container Instance group and container within. After that.. Happy building !

 

online

Comments are closed.