Docker IIS Container “Hello World” Example
I’ve always been intrigued a little with running a docker iis container and turns out it was fairly easy!
Getting Started
Install Docker: The first thing we need is a docker installed. I’m using docker for windows and can be installed here
Set Docker to Use “Windows Containers” by right-clicking on the docker icon in the system tray


Pull Down Docker IIS Image:
Open a command/powershell prompt and type
Docker pull docker pull mcr.microsoft.com/windows/servercore/iis
Test Out The Default Image
*Open a windows command or powershell prompt and type:
docker run -ti -p 80:80 microsoft/iis:latest
Note: you should see something like:
Service ‘w3svc’ has been stopped and ‘w3svc’ has started
To test type in http://localhost and the default iis page should come up!
Setup Hello World
Now that we tested our out of box IIS image lets derive from to create a new docker image with a ‘hello world’ page
- In create a docker folder
- In command prompt type
mkdir docker-iis
cd docker-iis
mkdir hello-world-folder
echo 'hello world' > .\hello-world-folder\index.htm
3. Create the Dockerfile
FROM microsoft/iis
expose 80
RUN cmd.exe /c "del /s /q c:\inetpub\wwwroot*"
WORKDIR c:/inetpub/wwwrootCOPY hello-world-folder/ .
Build Docker and Run
To build docker you simply specify the folder of the dockerfile
In the command line, type “docker build [path to docker-iis] -t iis-hello”
The end result will have message like “successfully tagged iis-hello:latest” and we know that the iis-hello tagged image build was added to the local docker repository
Run the new docker image by typing the following in the command prompt:
docker run -ti -p 80:80 iis-hello:latest
Naviagate to your http://localhost and you should successfully see hello world below
