Using containers as self-hosted agents
Azure Pipelines supports using Docker containers as the compute target for running pipeline jobs. You can use both Windows containers (Windows Server Core/Nano Server) and Linux containers (Ubuntu) to host your agents.
In order to connect the container to your Azure DevOps organization, you'll need to pass a few environment variables, such as the agent pool name, personal access token, and so on.
Setting up Windows containers as Azure pipeline agents
In order to use Windows containers as Azure pipeline agents, you need to build the container image first and then run it with your Azure DevOps organization environment variables. Let's look at the process.
Building the container image
Follow these steps to build the container image:
- Launch Command Prompt and run the following commands:
mkdir C:\dockeragent cd C:\dockeragent
- Create a new file named
Dockerfile
(no extension) and update it with the following content...