Window Server 2016 and Windows Containers
1. Windows 2016 Virtual Machine
2. Install Containers Feature
Restart-Computer -ForceOnce the machine is restarted, continue with following
3. Install Docker
Invoke-WebRequest "https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip" -OutFile "$env:TEMP\docker.zip" -UseBasicParsingYou will have two executable files in the extracted directory as shown
Alternate Installation Option
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider
Once installed, verify that docker is running fine your machine by type in the following
docker run microsoft/sample-dotnet
You should see a message of the like "Welcome to .Net Core!" on your console window. This means that your docker instance is working fine.
4. Pulling microsoft/windowservercore image
So, this is where I got stuck a bit. I was trying to use microsoft/nanoserver, which is a fraction of a size of full windows image and support .Net Core. In the end, I found out that running vso agent on server on nano server is not supported yet.
So, I pulled the full server core image. You can do it by running
docker pull microsoft/windowsservercore
The image is about 8GB and takes some time to download. Once pull, run the image by typing in
docker run microsoft/windowsservercore
At this stage, we are on a windows docker container running Windows 10. I checked in by typing and got the following version
Major Minor Build Revision
----- ----- ----- --------
10 0 14393 0
5. Running VSO Agent
Now that we have a running container, the steps to run VSO Agent is as simple as running it on any Windows 10 machine.
The only complication is the lack of GUI, so I used powershell to download zip file and extract it as follows
Invoke-WebRequest https://github.com/Microsoft/vsts-agent/releases/download/v2.108.0/vsts-agent-win7-x64-2.108.0.zip -outfile vsts-agent-win7-x64-2.108.0.zip
Expand-Archive -Path .\vsts-agent-win7-x64-2.108.0.zip -DestinationPath C:\vsts-agent
You will see the usual vsts agent's files in the destination directory. Simply type in .\config.cmd and follow instructions.