exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 1 question 178 discussion

Actual exam question from Microsoft's 70-486
Question #: 178
Topic #: 1
[All 70-486 Questions]

DRAG DROP -
You are developing an ASP.NET Core MVC API microservice that calculates and provides loan rates. The microservice is configured to listen on port 6000.
The microservice must be deployed to a Docker container in Windows. You add a file named Dockerfile to the microservice project.
You need to build the Docker image.
In which order should you perform the actions? To answer, move all actions from the list of actions to the answer area and arrange them in the correct order.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
Step 1: Use the FROM instruction to define the base image.
FROM creates a layer from the ubuntu Docker image.
The first FROM command is an important Docker command, allowing you to pull dependencies from other images.
Step 2: Use the WORKDIR instruction to define the working directory
The WORKDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile.
Step 3: Use the COPY instructions to copy the source code into the image and then use the RUN instruction to restore NuGet packages.
Step 4: Use the ENTRYPOINT instruction to use the container as an executable
Step 5: Use the EXPOSE instruction to specify the listen port and build and run the application.
References:
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Dreamchaser1980
Highly Voted 4 years, 10 months ago
A similar question can be found here: https://www.examtopics.com/discussions/microsoft/view/11208-exam-70-486-topic-1-question-135-discussion/. The example uses the following order of actions: FROM WORKDIR EXPOSE COPY ENTRYPOINT However, if you look in the documentation, it doesnt matter where the EXPOSE is placed, because: The EXPOSE instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published. As can be read in urls below. https://docs.docker.com/engine/reference/builder/#environment-replacement https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-3.1#build-and-deploy-manually
upvoted 6 times
...
michael243
Most Recent 4 years, 3 months ago
I think it runs the cleanest when expose is at the end, the question also has the expose task build and run the application, so that also makes me think it should be at the end.
upvoted 1 times
...
elevator44
4 years, 7 months ago
FROM, EXPOSE, WORKDIR, COPY/RUN, ENTRYPOINT ^^This order according to pluralsight https://www.pluralsight.com/blog/software-development/how-to-build-custom-containers-docker FROM mcr.microsoft.com/dotnet/core/aspnet LABEL author=”Name” ENV ASPNETCORE_URLS=http://*:5000 ENV ASPNETCORE_ENVIRONMENT=”production” EXPOSE 5000 WORKDIR /app COPY ./dist . ENTRYPOINT [“dotnet”, “Your-Project-Name.dll”]
upvoted 4 times
...
Anette
4 years, 7 months ago
1. From 2. Expose 3. Copy 4. Entrypoint 5. Workdir
upvoted 1 times
Anette
4 years, 7 months ago
sorry, its not like this.
upvoted 1 times
...
...
DVR98
4 years, 9 months ago
According to this: https://docs.docker.com/engine/examples/dotnetcore/ It's: FROM, WORKDIR, COPY, ENTRYPOINT FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 WORKDIR /app COPY --from=build-env /app/out . ENTRYPOINT ["dotnet", "aspnetapp.dll"]
upvoted 3 times
Anette
4 years, 7 months ago
Yes, but where is EXPOSE?
upvoted 1 times
...
...
zimzimzimma
4 years, 10 months ago
Looks like the place where EXPOSE should reside is dispuated. Here is an example: https://docs.docker.com/compose/rails/ From this examples, I think it should be FROM WORKDIR COPY ENTRYPOINT EXPOSE
upvoted 2 times
...
pizzaHawai
4 years, 10 months ago
I believe it is like this: from, workdir, expose, copy, entrypoint E.g. FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 ARG source WORKDIR /app EXPOSE 80 COPY ${source:-obj/Docker/publish} . ENTRYPOINT ["dotnet", " MySingleContainerWebApp.dll "] (https://docs.microsoft.com/en-us/dotnet/architecture/microservices/docker-application-development-process/docker-app-development-workflow)
upvoted 4 times
...
AndreeaP
4 years, 11 months ago
I think it should be FROM, WORKDIR, COPY, EXPOSE, ENTRYPOINT (https://stackify.com/docker-build-a-beginners-guide-to-building-docker-images/)
upvoted 4 times
...
Albeom
4 years, 11 months ago
I think it should be in the next order: FROM, EXPOSE, WORKDIR, COPY, ENTRYPOINT
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago