Contents tagged with Windows
In an earlier post which I published a week go, went through the steps needed for setting up an IIS server in a Docker container running on a Windows Server 2016 machine. In this post, I will explain the steps needed to host an ASP.NET MVC application on a IIS server running inside a docker container based on Windows
Step 1 : Setup IIS with ASP.NET Support
First, we will create a new image based on the official IIS image released by Microsoft. Because in that image features such as ASP.NET 4.5 and Microsoft Web Deploy are not installed by default and we need to have it for deloying our application. So download the installer package for Web Deploy from the Microsoft site and store it in a folder in your local machine. To create the image I have created a Dockerfile as given below
FROM microsoft/iis RUN dism /online /enable-feature /all /featurename:IIS-ASPNET45
RUN mkdir c:\install
ADD WebDeploy_amd64_en-US.msi /install/WebDeploy_amd64_en-US.msi
WORKDIR /install RUN powershell start-Process msiexec.exe -ArgumentList '/i c:\install\WebDeploy_amd64_en-US.msi /qn' -Wait
Let's create the image by executing the following command
docker build -t amaldevv/aspnetwithwebdeploy .
When the command is executed, it will first check whether image for IIS is available in locally in docker and if it's not found then will download it from Microsoft repository in Docker Hub. The second statement in the file is for installing the ASP.NET 4.5 feature and once that is finished it will create a folder named install in the container and then copies the installer package for Web Deploy which we downloaded earlier into it. After that msiexec process is called using Powershell to install Web Deploy inside the container
You can verify the images is successfully built or not by executing the docker images command as shown below
Many of you may already aware that Windows Server 2016 now natively supports Docker containers and it means that the same shared-kernel-isolation-paradigm from the Linux world is now well and truly supported in Windows too. The advantage of this approach is that your containers will load more speedily with minimum amount of resources. Please go through this link to read more about it. In this post, I will show how to host IIS in a docker container in Windows Server 2016 machine.
Step 1 : Get the base image for IIS
First you need to pull the latest image for IIS from the Docker hub by executing the following statement.
docker pull microsoft/iis
It will pull the image with the tag latest from the docker repository. If you want specify a different tag, then you need to specify that after the image name with a color(:) prepended to it
If you execute the docker images, our newly downloaded image will be shown in the list as shown below.
Step 2 : Create the Container
Now, you need to create a container based on the image which we downloaded in the earlier step. For that you will to need to execute the following command
docker run -it -d -p 80:80 microsoft/iis
With this command, we are telling Docker to create a container based on microsoft/iis image. The -d switch indicates that container should be run in the background and -p switch is used for mapping the port numbers for host and the container. In this example we are redirecting the requests coming into the port #80 in the host machine to port #80 in the container we just created. When it's successfully executed, it will emit the full container id and then returns to the prompt as shown below
You can verify whether the container is running or not by executing the docker ps command. The ps command will show all the active processes running in docker as shown below
Step 3 : Check IIS status
You verify whether the IIS running inside the container is properly serving content or not by typing in the IP address of the host machine in the browser. If everything is good you will see the default web site page of the IIS as shown below.
Since port # 80 is used for http by default and we don't need to provide that along with the IP address. The redirection magic is done by the daemon whom will see a request at port 80 is coming in the host machine, intercepts it and redirects it to the port#80 of our container which then spits out the default website page.
As you all know Windows 10 is going to be released worldwide on July 29 and through this series of posts, I will be posting about a number of features and changes coming to the new OS.
And the much talked about features are..
1. Start Menu makes a comeback !!!
This was one of the most requested features in the uservoice forums since the launch of Windows 8 and finally Microsoft has responded to the criticisms by bringing it back. They haven't gone back to experience that we had in Windows 7, but introduced a new user interface with the modern UI and managed to include both the apps and old program list in one place.
Microsoft will be releasing the latest version of their operating system named Windows 8 very soon and infact it's already available for download for MSDN and Technet subscribers.
For the unlucky ones like me has the option to download a 90 day evaluation of the same from here.
Before you go for downloading, you have to take a note of couple of points
- This evaluation version will expire after 90 days and wont be able to upgrade.
- It's better to go for the installation in a virtual environment so that it will be easier for you to upgrade from your existing version. Otherwise you will have to uninstall the evaluation first and then do an upgrade.
- Inorder to the get the link for the download, you have to should have a Microsoft Account and should also activate the product within 10 days of installation.
You have options for 32-bit and 64-bit versions which is available in ISO format. You can get more details from here.
So I have chosen the 64-bit version which is around 3.5 GB of size and I will be using Oracle Virtual Box for virtualization. It's a well documented fact that MS is not supporting either Virtual PC or
VMware as virtual environment tools.
First you have to either mount the ISO image as a drive or you can burn the image on to a disc and use that as an bootable disk to start the setup process. Upon booting you will be presented
with a splash screen featuring the much talked about new windows logo as shown below.
In the next screen you will be asked to selected the regional preferences and language settings
In the next screen, you will be provided with two options, Install and Repair. Since we are going for a fresh installation,
will have to click on the Install Now button.