官术网_书友最值得收藏!

Creating a Dockerfile

As we will be hosting the web page in the container using IIS, we need to create a Dockerfile that uses the mcr.microsoft.com/windows/servercore/iis official image as the base image for the build. We will use a Docker image with the windowsservercore-1903 tag to ensure that we are running a version that matches the host OS and make it possible to use process isolation.

Create a new file in your workspace named Dockerfile, containing the following:

FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-1903

RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
WORKDIR /inetpub/wwwroot
COPY index.html .

Visual Studio Code gives you a lot of snippets while writing the Dockerfile, providing that you have named the file following the expected convention. You can also bring up the list of snippets by pressing Ctrl + SPACE while editing.

In the next subsection, you will learn how to manually build a Docker image based on the Dockerfile you have just created.

主站蜘蛛池模板: 新绛县| 稻城县| 德州市| 剑川县| 安塞县| 奉新县| 沂南县| 阿拉善盟| 锡林郭勒盟| 吉林市| 六枝特区| 广水市| 虹口区| 涿州市| 花莲市| 汝南县| 渭源县| 盘山县| 宁德市| 仁化县| 万全县| 东乌| 永登县| 玉树县| 顺平县| 吉木乃县| 宣武区| 江口县| 孝感市| 龙泉市| 枣强县| 罗平县| 天等县| 无为县| 新民市| 青田县| 长白| 普宁市| 怀远县| 静宁县| 当雄县|