Developing Applications Using Cisco Core Platforms and APIs (DEVCOR) — Question 191
An engineer is developing a Docker container for an application in Python. For security reasons the application needs to be accessible on port 5001 only. Which line should be added to the dockerfile in order to accomplish this?
Answer options
- A. ADD PORT 5001
- B. ENTRYPOINT 5001
- C. EXPOSE 5001
- D. PORT SRC 5001
Correct answer: C
Explanation
The correct answer is C, EXPOSE 5001, as it specifies that the container listens on the specified network port at runtime. Options A and D are incorrect because they do not use the correct Dockerfile instructions, and B is incorrect as ENTRYPOINT defines the command to run when the container starts, not the port configuration.