未加星标

Running IIS from a Docker Container in Windows Server 2016

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二04 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Many of you may already awarethat 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


Running IIS from a Docker Container in Windows Server 2016

If you execute the docker images, our newly downloaded image will be shown in the list as shown below.


Running IIS from a Docker Container in Windows Server 2016
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


Running IIS from a Docker Container in Windows Server 2016

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


Running IIS from a Docker Container in Windows Server 2016
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.


Running IIS from a Docker Container in Windows Server 2016

Sinceport # 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.

Categories: Web Developement , Docker

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

分页:12
转载请注明
本文标题:Running IIS from a Docker Container in Windows Server 2016
本站链接:http://www.codesec.net/view/533439.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(61)