Developing Applications and Automating Workflows Using Cisco Platforms (DEVASC) — Question 335
A development team needs to containerize an application named 'custapp4o3p2r6d3s6w7x6t9'. A Dockerfile has been created and now the docker build command must be run using the current folder to find the Dockerfile, build the image and create a local repository named 'custapp4d5c-repo' that points to that image. Which command must be used?
Answer options
- A. docker build custapp4d5c-repo Dockerfile .
- B. docker build -t acustapp4d5c-repo Dockerfile.txt
- C. docker build custapp4d5c-repo -f Dockerfile.txt
- D. docker build -t custapp4d5c-repo -f Dockerfile .
Correct answer: D
Explanation
The correct command is option D, as it properly uses the -t flag to tag the image as 'custapp4d5c-repo' while specifying the Dockerfile with the -f flag and indicating the current directory with a dot. Option A incorrectly places the repository name before the Dockerfile; option B refers to a non-existent Dockerfile.txt instead of the correct Dockerfile; and option C also uses the wrong Dockerfile name, which would lead to an error.