Docker: Jenkins Build Server on Windows Server Core

Big fan of Jenkins! I’ve really enjoyed the flexibility that this CI server provides. While it’s easy to run a Linux container with Jenkins and do .NET Core builds it’s not possible to build traditional ASP.NET projects… unless you install Mono.. but I could never get that to work. After contemplating my options, I decided to try and set up Jenkins on a Docker Windows Server Core image.

This script installs ASP.NET, .NET Core, Java, and Jenkins on a Windows Server Core image.

GitHub: Docker Windows Server Jenkins

WARNING: this post is a work in progress. The current Dockerfile builds and creates a Windows Server with Jenkins but there are still some issues with this process.


This dockerfile builds off the Windows Server Core image.

LABEL maintainer="@mrjamiebowman"


# set up dirs
RUN mkdir C:\setup
RUN mkdir C:\jenkins
RUN mkdir C:\Java\jre1.8.0_202\bin

# paths
RUN SetX PATH "%path%;C:\Program Files\7-zip;C:\Java\jre1.8.0_202\bin"
RUN SetX JAVA_HOME 'C:\Java\jre1.8.0_202'

# set working directory
WORKDIR /setup

# 7zip
COPY installers/7z1602-x64.exe /setup/
RUN powershell -Command "Start-Process -Wait -FilePath 'C:\setup\7z1602-x64.exe' -ArgumentList '/S'"

# install jre 8
COPY installers/jre-8u202-windows-x64.tar.gz /Java/
RUN 7z.exe e jre-8u202-windows-x64.tar.gz -y
RUN 7z.exe x jre-8u202-windows-x64.tar -y

# install chocolatey
RUN powershell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))"

# install apps
WORKDIR /setup

# install 4.8 developer pack
COPY installers/ndp48-devpack-enu.exe /setup/
RUN ndp48-devpack-enu.exe /q /install

# install .net core 3.1
COPY installers/dotnet-sdk-3.1.301-win-x64.exe /setup/
RUN dotnet-sdk-3.1.301-win-x64.exe /q /install

# set up jenkins
ENV HOME /jenkins
RUN powershell -Command "(New-Object System.Net.WebClient).DownloadFile('', '/jenkins/jenkins.war');"

EXPOSE 50000

# entrypoint
COPY entrypoint.bat /setup/

ENTRYPOINT /setup/entrypoint.bat
View Gist on GitHub


I ran into an issue where executing the jar file did not keep the process running in the foreground. I’m not sure why… However, for the sake of time I used ping -t localhost to keep the container running. This seemed to work.

java -jar C:\jenkins\jenkins.war
ping -t localhost

Building a .NET Core Project in Jenkins

Building an ASP.NET Core Project in Jenkins