Dockerfile for IIS
Перейти к файлу
sujitnayak cb27fbcffb
Merge pull request #209 from microsoft/user/sujitn/dockerfile_svr2025
Add dockerfile for Windows Server 2025
2024-11-12 17:22:00 -08:00
.github Update CODEOWNERS 2018-01-05 17:50:42 -08:00
samples Update README.md 2019-10-28 13:54:46 -07:00
windowsservercore-20H2 Update for 2104b 2021-04-13 16:18:50 -07:00
windowsservercore-1803 Upgrading servicemonitor.exe (#171) 2020-03-25 12:45:23 -07:00
windowsservercore-1909 Upgrading servicemonitor.exe (#171) 2020-03-25 12:45:23 -07:00
windowsservercore-2004 docker file for 2004 2020-06-09 14:54:39 -07:00
windowsservercore-2009 added windows 2009 dockerfile (#178) 2020-10-21 10:50:58 -07:00
windowsservercore-insider one more file. 2021-08-18 15:51:05 -07:00
windowsservercore-ltsc2016 Upgrading servicemonitor.exe (#171) 2020-03-25 12:45:23 -07:00
windowsservercore-ltsc2019 Upgrading servicemonitor.exe (#171) 2020-03-25 12:45:23 -07:00
windowsservercore-ltsc2022 Update for Windows Server 2022. 2021-08-17 14:21:05 -07:00
windowsservercore-ltsc2025 Add dockerfile for Windows Server 2025 2024-11-12 16:51:10 -08:00
LICENSE.md Initial upload 2016-09-30 12:50:00 -07:00
README.md Remove support for 20H2 2022-09-06 13:23:50 -07:00
SECURITY.md Microsoft mandatory file 2022-09-01 18:14:38 +00:00

README.md

IIS Docker Image

IIS Docker Image

Supported Windows Server 2022 amd64 tags

docker pull mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2022

windowsservercore-ltsc2022, latest (windowsserver/Dockerfile)

Supported Windows Server 2019 amd64 tags

docker pull mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019

windowsservercore-ltsc2019, latest (windowsserver/Dockerfile)

Supported Windows Server 2016 amd64 tags

docker pull mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2016

windowsservercore-ltsc2016, latest (windowsserver/Dockerfile)

What is IIS?

Internet Information Services (IIS) for Windows® Server is a flexible, secure and manageable Web server for hosting anything on the Web.

How to use this image?

Create a Dockerfile with your website

FROM mcr.microsoft.com/windows/servercore/iis

RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*

WORKDIR /inetpub/wwwroot

COPY content/ .

You can then build and run the Docker image:

$ docker build -t iis-site .
$ docker run -d -p 8000:80 --name my-running-site iis-site

There is no need to specify an ENTRYPOINT in your Dockerfile since the microsoft/iis base image already includes an entrypoint application that monitors the status of the IIS World Wide Web Publishing Service (W3SVC).

Verify in the browser

On newer hosts (Windows Server, version 1803 and newer)

You can connect to the running container using http://localhost:8000 in the example shown.

On older hosts (Windows Server, version 1709 and older)

If you are running an older host, you cannot use http://localhost to browse your site from the container host. This is because of a known behavior in WinNAT and you need to use the IP address of the container.

Once the container starts, you'll need to finds its IP address so that you can connect to your running container from a browser. You use the docker inspect command to do that: docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" my-running-site You will see an output similar to this:

172.28.103.186	

You can connect the running container using the IP address and configured port, http://172.28.103.186:80 in the example shown.

In addition to static content, IIS can run other workloads including, but not limited to ASP.NET, ASP.NET Core, NodeJS, PHP, and Apache Tomcat.

For a comprehensive tutorial on running an ASP.NET app in a container, check out the tutorial on the docs site.

Supported Docker Versions

This image has been tested on Docker Versions 17.10 or higher.

License

MICROSOFT SOFTWARE SUPPLEMENTAL LICENSE TERMS

CONTAINER OS IMAGE

Microsoft Corporation (or based on where you live, one of its affiliates) (referenced as “us,” “we,” or “Microsoft”) licenses this Container OS Image supplement to you (“Supplement”). You are licensed to use this Supplement in conjunction with the underlying host operating system software (“Host Software”) solely to assist running the containers feature in the Host Software. The Host Software license terms apply to your use of the Supplement. You may not use it if you do not have a license for the Host Software. You may use this Supplement with each validly licensed copy of the Host Software.

User Feedback

If you have any issues or concerns, reach out to us through a GitHub issue.