Create a Container Image with Windows Server 2019 | AZ-300 Exam Question

Create a Container Image with Windows Server 2019

Question

You have a server named Server1 that runs Windows Server 2019. Server1 is a container host.

You plan to create a container image.

You create the following instructions in a text editor.

FROM mcr.microsoft.com/windows/servercore:lts2019

LABEL maintainer="User1@contoso.com"

RUN dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart

RUN echo "Hello World!" > c:\inetpub\wwwroot\index.html

You need to be able to automate the container image creation by using the instructions.

To which file should you save the instructions?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B

The Dockerfile is a text file that contains the instructions needed to create a new container image.

https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile

Deploy and Configure Infrastructure

The correct answer is B. Dockerfile.

A Dockerfile is a plain text file that contains instructions to build a Docker image. The Dockerfile is used as input by the docker build command to automate the creation of the container image. The Dockerfile contains a set of instructions that are executed in order to create the image. Each instruction creates a new layer in the image, and the resulting image is the combination of all layers.

In this case, the Dockerfile contains the following instructions:

  • FROM mcr.microsoft.com/windows/servercore:lts2019: This instruction specifies the base image for the container. It specifies the mcr.microsoft.com/windows/servercore:lts2019 image, which is a Microsoft Windows Server Core image based on the Long-Term Servicing Channel (LTSC) version of Windows Server 2019.
  • LABEL maintainer="User1@contoso.com": This instruction adds a label to the image that specifies the maintainer's email address.
  • RUN dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart: This instruction runs the dism.exe command to enable the IIS web server feature on the container.
  • RUN echo "Hello World!" > c:\inetpub\wwwroot\index.html: This instruction creates an index.html file in the c:\inetpub\wwwroot directory and writes the text "Hello World!" to the file.

By saving these instructions to a Dockerfile and running the docker build command, you can automate the creation of a container image that includes the IIS web server feature and an index.html file with the text "Hello World!".

The other options are incorrect:

  • dockerconfig.json: This file is used to store Docker client authentication credentials, such as Docker Hub credentials. It is not used for container image creation.
  • daemon.json: This file is used to configure the Docker daemon settings, such as network settings and storage drivers. It is not used for container image creation.
  • Build.ini: This is not a valid file for Dockerfile instructions. It is likely a made-up option to confuse test-takers.