Q: 4
Refer to the exhibit.
A developer needs to create a Docker image that listens on port 5000. Which code snippet must be placed onto the blank in the code?
Options
Discussion
Option C makes sense here. In a Dockerfile,
EXPOSE 5000 tells Docker that the container will listen on port 5000. The other options aren't valid Dockerfile instructions, so not really applicable. Pretty sure it's C but open to corrections if I'm missing something.Its C
C or A, but I'm leaning C. EXPOSE is the Dockerfile instruction for declaring container ports, but A feels like a trap since "PORT" looks tempting if you're skimming. Pretty sure it's C, though.
C tbh
Guessing C is what you need. In a Dockerfile, only EXPOSE 5000 is valid to let Docker know about the listening port. The rest aren't even recognized keywords, so I don't see how they'd work. Correct me if you think otherwise.
C not A. EXPOSE is the actual Dockerfile instruction, easy to mix up since PORT looks right at first glance.
Probably C, saw a similar question on a practice exam.
EXPOSE 5000 is the right Dockerfile directive to tell Docker the container listens on that port. A and D aren't valid syntax. Let me know if you see it different.Be respectful. No spam.