0

Microsoft has created a container for VSTS CLI. It exists at microsoft/vsts-agent on docker.hub. Unfortunately, it only has a lynx container, so I am trying to build a Windows container for VSTS CLI. This is the Microsoft page that shows how to install it:

https://learn.microsoft.com/en-us/cli/vsts/install?view=vsts-cli-latest

johnstep shows how to install an MSI file at https://github.com/moby/moby/issues/30395.

So using the above information I tried this Docker file:

FROM microsoft/windowsservercore

ADD https://aka.ms/vsts-cli-windows-installer .

RUN vsts-cli-0.1.0b1.msi

# Setup Powershell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

This resulted in this error message:

Sending build context to Docker daemon   64.1MB
Step 1/4 : FROM microsoft/windowsservercore
 ---> 4dba31379dad
Step 2/4 : ADD https://aka.ms/vsts-cli-windows-installer .
Downloading [==================================================>]  60.75MB/
 ---> Using cache
 ---> 6a606c72348f
Step 3/4 : RUN vsts-cli-0.1.0b1.msi
 ---> Running in fef0829916b4
**'vsts-cli-0.1.0b1.msi' is not recognized as an internal or external command
operable program or batch file.**
The command 'cmd /S /C vsts-cli-0.1.0b1.msi' returned a non-zero code: 1

I am not sure what is wrong with the Docker file. Maybe there is a problem with the MSI file. I am running Docker on Windows Server 2016 with Windows Server core installed.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ATXGearHead12
  • 47
  • 1
  • 8

1 Answers1

0

This is because the Docker engine will create a folder named vsts-cli-windows-installer and put the downloaded file into it. It's documented here.

Instead, modify your DOCKERFILE as below:

ADD https://aka.ms/vsts-cli-windows-installer/ a.msi RUN a.msi

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Gregory Suvalian
  • 3,566
  • 7
  • 37
  • 66