CompTIA Linux+ (XK0-005) — Question 95
A cloud engineer is asked to copy the file deployment.yaml from a container to the host where the container is running. Which of the following commands can accomplish this task?
Answer options
- A. docker cp container_id/deployment.yaml deployment.yaml
- B. docker cp container_id:/deployment.yaml deployment.yaml
- C. docker cp deployment.yaml local://deployment.yaml
- D. docker cp container_id/deployment.yaml local://deployment.yaml
Correct answer: B
Explanation
The correct command is B because it uses the correct syntax to specify the source file from the container with the colon (:) indicating it's from within the container's filesystem. Option A is incorrect because it lacks the required colon, while C and D incorrectly refer to 'local://' which is not a valid destination syntax in this context.