CompTIA Cloud+ (CV0-004) — Question 85
Which of the following container commands implements network port mapping?
Answer options
- A. $docker run –it myimage –e /bin/port 8080
- B. $docker run myimage:port
- C. $docker run –it –p 1-65535 myimage –e netstat 8080
- D. $docker run –it –p 80:8080 myimage
Correct answer: D
Explanation
The correct answer is D, as it explicitly uses the '-p' option to map port 80 on the host to port 8080 in the container. Options A and B do not include port mapping commands, while option C attempts to map a range of ports but does not specify a proper mapping format.