200-901 · Question #535
200-901 Question #535: Real Exam Question with Answer & Explanation
The correct answer is C: EXPOSE 80. In a Dockerfile, the EXPOSE instruction declares which ports a container expects to listen on, indicating its intended network reachability from outside.
Question
Refer to the exhibit. An engineer is creating a Dockerfile for an application to run on a container. Application is a web application build on the Python Flask framework. Which port of the Dockerfile provides desired reachability to the application from the outside of the container?
Options
- ARUN pip3 install Flask
- BMAINTAINER User One ([email protected])
- CEXPOSE 80
- DCOPY ./app
Explanation
In a Dockerfile, the EXPOSE instruction declares which ports a container expects to listen on, indicating its intended network reachability from outside.
Common mistakes.
- A.
RUN pip3 install Flaskexecutes a command during the image build process to install Python dependencies, which is not related to network port exposure. - B.
MAINTAINER User One ([email protected])is a deprecated instruction used for setting metadata about the image author, unrelated to network ports. - D.
COPY ./appcopies application source code from the build context into the Docker image, which is a file system operation and has no direct bearing on network port reachability.
Concept tested. Dockerfile EXPOSE instruction
Reference. https://docs.docker.com/reference/dockerfile/#expose
Topics
Community Discussion
No community discussion yet for this question.