exam questions

Exam AZ-300 All Questions

View all questions & answers for the AZ-300 exam

Exam AZ-300 topic 16 question 20 discussion

Actual exam question from Microsoft's AZ-300
Question #: 20
Topic #: 16
[All AZ-300 Questions]

Note: This question is part of series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have a server named Server1 that runs Windows Server 2019. Server1 is a container host.
You are creating a Dockerfile to build a container image.
You need to add a file named File1.txt from Server1 to a folder named C:\Folder1 in the container image.
Solution: You add the following line to the Dockerfile.
COPY File1.txt C:/Folder1/
You then build the container image.
Does this meet the goal?

  • A. Yes
  • B. No
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️
Copy is the correct command to copy a file to the container image but the root directory is specified as '/' and not as 'C:/'.
References:
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy https://docs.docker.com/engine/reference/builder/

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
anderhong
Highly Voted 5 years ago
This should be Yes. Correctly copy file to c:/Folder/ https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile
upvoted 32 times
praveen97
4 years, 9 months ago
Yes, this should be Yes https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile#considerations-for-using-copy-with-windows
upvoted 4 times
misushant
4 years, 9 months ago
Correct. This should be YES.
upvoted 3 times
...
...
...
PierroD
Highly Voted 4 years, 12 months ago
Copy is the correct command to copy a file to the container image. But "C:/Folder1" instead of "C:\Folder1".
upvoted 8 times
...
aabdous
Most Recent 4 years, 5 months ago
The answer is yes. Look that https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile
upvoted 1 times
...
ipindado2020
4 years, 7 months ago
Should be yes.... It is a valid syntax for windows based containers
upvoted 1 times
...
BEB
4 years, 8 months ago
This is a YES. Considerations for using COPY with Windows On Windows, the destination format must use forward slashes. For example, these are valid COPY instructions: Dockerfile COPY test1.txt /temp/ COPY test1.txt c:/temp/ See https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile
upvoted 5 times
...
Explen
4 years, 10 months ago
Considerations for using COPY with Windows On Windows, the destination format must use forward slashes. For example, these are valid COPY instructions: Dockerfile Copy COPY test1.txt /temp/ COPY test1.txt c:/temp/ https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile
upvoted 3 times
...
Explen
4 years, 10 months ago
Considerations for using COPY with Windows On Windows, the destination format must use forward slashes. For example, these are valid COPY instructions: Dockerfile Copy COPY test1.txt /temp/ COPY test1.txt c:/temp/ https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile
upvoted 2 times
...
abhishek7181
4 years, 10 months ago
It's A
upvoted 2 times
...
Rooh
4 years, 11 months ago
Yes, copy command is used to copy the file to the existing docker and then build a new docker image
upvoted 1 times
...
Prash85
4 years, 11 months ago
It is yes.. Correct Format: COPY test1.txt /temp/ COPY test1.txt c:/temp/ backslashes won't work: COPY test1.txt c:\temp\
upvoted 2 times
...
ant2ant
4 years, 11 months ago
Considerations for using COPY with Windows On Windows, the destination format must use forward slashes. For example, these are valid COPY instructions: Dockerfile Copy COPY test1.txt /temp/ COPY test1.txt c:/temp/ Meanwhile, the following format with backslashes won't work: Dockerfile Copy COPY test1.txt c:\temp\
upvoted 1 times
...
n0t4u2c
4 years, 11 months ago
Considerations for using COPY with Windows On Windows, the destination format must use forward slashes. For example, these are valid COPY instructions: Dockerfile Copy COPY test1.txt /temp/ COPY test1.txt c:/temp/
upvoted 5 times
...
xxhermitsxx
5 years ago
Shouldn't it be the other way around? Given the answer is saying it needs to include the C directory and the questions doesn't have it?
upvoted 1 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