What is the use of the EXPOSE instruction in a Dockerfile?

  1. To run a service
  2. To open a port on the host
  3. To document which port the container listens on
  4. To expose a volume
Correct answer To document which port the container listens on

Explanation

EXPOSE is used to indicate the port on which the container listens.

Update: Admin added a tag on this question

Topics

By Admin · · 40 views