Add & Url — DCA Practice Question
A representative Docker Certified Associate (DCA) exam question on Add & Url. Work through it below, then read why each option is right or wrong.
This question is part of the free Docker Certified Associate practice test.
Short answer
The correct answer is C. The file is saved as /usr/local/pkg.tar, named from the URL path, and it is not extracted.
The correct answer is C. The file is saved as /usr/local/pkg.tar, named from the URL path, and it is not extracted. A is wrong because remote tar archives are not extracted by default. B is wrong because URL sources are supported, and the trailing slash makes ADD infer the filename. D is wrong because the trailing slash makes ADD infer the filename from the URL path, so the file does get a name.
The Question
A Dockerfile uses ADD https://example.com/tools/pkg.tar /usr/local/ with a trailing slash on the destination. The remote file is a tar archive. What is the result?
Why C is correct
The correct answer is C. The file is saved as /usr/local/pkg.tar, named from the URL path, and it is not extracted. A is wrong because remote tar archives are not extracted by default. B is wrong because URL sources are supported, and the trailing slash makes ADD infer the filename. D is wrong because the trailing slash makes ADD infer the filename from the URL path, so the file does get a name.
Why the other options are wrong
Option A does not satisfy the requirement in the scenario. Review the explanation above: the correct choice (C) is the only one that fully meets every constraint stated in the question.
Option B does not satisfy the requirement in the scenario. Review the explanation above: the correct choice (C) is the only one that fully meets every constraint stated in the question.
Option D does not satisfy the requirement in the scenario. Review the explanation above: the correct choice (C) is the only one that fully meets every constraint stated in the question.
Key idea: Add & Url
The correct answer is C. The file is saved as /usr/local/pkg.tar, named from the URL path, and it is not extracted. A is wrong because remote tar archives are not extracted by default. B is wrong because URL sources are supported, and the trailing slash makes ADD infer the filename. D is wrong because the trailing slash makes ADD infer the filename from the URL path, so the file does get a name. On the DCA exam, questions in the "Image Creation, Management, and Registry" domain test whether you can map a scenario's constraints to the right choice. Read the requirement carefully, eliminate options that violate any single constraint, and pick the one that satisfies all of them with the least operational overhead.
Ready to see how you'd score?
Take the free practice quiz and find out which Docker Certified Associate domains you need to focus on. No signup required.
Practice 5 similar questions
Same cert, same or adjacent domain. Use these after reviewing the explanation.
Related Docker Certified Associate Practice Questions
Official sources used
Verify program and exam details at the source before scheduling.