Run pytest inside of a Nano Server Container on Win10

Work in progress, but this is what I’ve got so far. I’ve been wanting to run small workloads in isolated environments that are repeatable and identical.

This is my Dockerfile, on my Win10 workstation, but customize to your environment and requirements as necessary for use. Windows Server 2016 Core is a little overkill, but I haven’t got all the necessary software running on Nano Server yet.

FROM microsoft/windowsservercore
# Because why not?
# Build docker image: docker build -t jeff1 .
# Run docker image: docker run -it jeff1 powershell
# Install Chocolatey for package installs
RUN powershell -c "iwr -UseBasicParsing | iex"
RUN choco install -y python2
RUN powershell -command [Environment]::SetEnvironmentVariable('PYTHONIOENCODING','utf-8','User')
RUN pip install --upgrade pip pytest paramiko boto
# This requires Administrator privileges, so leaving out for now
#RUN powershell -command "install-module pswindowsupdate -force;import-module -Name pswindowsupdate;Get-WUInstall -MicrosoftUpdate -IgnoreUserInput -AcceptAll"
RUN choco install -f -y --allow-empty-checksums strawberryperl vcpython27 curl git.install jdk8 openssh wixtoolset
# Placeholder for Windows Driver requirements
# git clone <git repo>
#RUN pytest <git repo>/