In this blog post, I’ll show you how I deploy an IIS Website Image automatically by reading and executing Instructions from a dockerFile.
Docker can build images automatically by reading the instructions from a Dockerfile and apply them. to the Image In real time, once completed we have a complete Image.
A Dockerfile is a text document that contains all the commands an admin will use to deploy and Image.
In my case, I’ll deploy and IIS Website Image with all the configuration listed in the dockerFile. including copying the Website content from the file and Installing IIS.
the image including copying the Website content from the file and Installing IIS.
Docker provides an additional layer of abstraction and automation of the operating system.
It also uses the resource isolation features like Hyper-V Containers.
Below, I have my dockerfile with Instructions to deploy Windows Server Core 2016 Image, Install IIS and copy the Website content to IIS.
FROM microsoft/windowsservercore RUN powershell.exe RUN powershell.exe Add-WindowsFeature web-server, web-webserver COPY /online/* c:/inetpub/wwwroot
Once, I have the dockerfile configured, I’ll save it without any extension and place it In a folder called IISSITE.
From the IISSITE folder, I’ll run the cmdlet below which will build the Image.
docker build -t iissite .
Once the image is completed successfully I’ll create a new container using the Image.
docker run -it --network=lan iissite
As you can see my website is up and running in a matter of seconds.
DockerFile is the recommended deploy method of images simply because we don’t need to run any cmdlets or configuration and the container.