How to install Builds Tools in a Docker container

After working through a few issues, we have posted how to install Visual Studio Build Tools 2017 into a Docker container. A Build Tools container can be very useful for continuous integration / continuous delivery (CI/CD) scenarios. You can also use these same steps for Visual Studio if Build Tools does not currently have everything you need.

Of note:

  • You can’t install on a base image using microsoft/windowsservercore:10.0.14393.1593. There was a bug preventing the bootstrapper from launching in a container. Older and newer images tested worked fine.
  • You can only install Windows SDK v10.0.14393 or newer, which means some projects may need to be retargeted if you want to use a container for CI/CD.
  • You’ll need to reconfigure Docker for Windows to allow larger disk sizes. To your daemon configuration file you’ll need to add: "storage-opts": [ "size=120GB" ] (or less; the space itself isn’t consumed unless actually used).
  • You’ll need to install using more than the default 1GB of memory: docker build -m 2GB. You don’t necessarily need to docker run like that unless building your code requires it.

This is only the beginning! Be sure to file new issues on the Developer Community web site if you don’t see any existing ones. We’ll keep working to make this process better.