nerdexam
Microsoft

AZ-204 · Question #202

Drag and Drop Question You plan to create a Docker image that runs an ASP.NET Core application named ContosoApp. You have a setup script named setupScript.ps1 and a series of application files…

The correct answer is FROM microsoft/aspnetcore:latest; COPY . / .; WORKDIR /apps/ContosoApp; RUN powershell ./setupScript.ps1; CMD ["dotnet", "ContosoApp.dll"]. The correct Dockerfile order follows Docker's build lifecycle: first establish the base image with FROM, then COPY all files into the container, set the WORKDIR to define the working directory, RUN the setup script during the build phase, and finally define the CMD to execute…

Submitted by obi.ng· Mar 30, 2026Implement containerized solutions - creating and configuring Docker images for .NET applications (AZ-204: Develop solutions that use Azure Container Registry and Azure Container Instances)

Question

Drag and Drop Question You plan to create a Docker image that runs an ASP.NET Core application named ContosoApp. You have a setup script named setupScript.ps1 and a series of application files including ContosoApp.dll. You need to create a Dockerfile document that meets the following requirements: - Call setupScripts.ps1 when the container is built. - Run ContosoApp.dll when the container starts. The Dockerfile document must be created in the same folder where ContosoApp.dll and setupScript.ps1 are stored. Which five commands should you use to develop the solution? To answer, move the appropriate commands from the list of commands to the answer area and arrange them in the correct order. Answer:

Exhibit

AZ-204 question #202 exhibit

Answer Area

Drag items

FROM microsoft/aspnetcore:latestWORKDIR /apps/ContosoAppCMD ["dotnet", "ContosoApp.dll"]COPY . / .RUN powershell ./setupScript.ps1

Correct arrangement

  • FROM microsoft/aspnetcore:latest
  • COPY . / .
  • WORKDIR /apps/ContosoApp
  • RUN powershell ./setupScript.ps1
  • CMD ["dotnet", "ContosoApp.dll"]

Explanation

The correct Dockerfile order follows Docker's build lifecycle: first establish the base image with FROM, then COPY all files into the container, set the WORKDIR to define the working directory, RUN the setup script during the build phase, and finally define the CMD to execute when the container starts. This sequence ensures all files are present before the working directory is set and the setup script runs, and CMD correctly defers ContosoApp.dll execution to container startup rather than build time.

Topics

#Docker#Dockerfile#ASP.NET Core#Containerization

Community Discussion

No community discussion yet for this question.

Full AZ-204 Practice