nerdexam
Cisco

300-910 · Question #22

A DevOps engineer has built a new container and must open port 8080 for intercontainer communication. Which command must be added in a Dockerfile to accomplish this goal?

The correct answer is A. EXPOSE 8080. The question asks for the correct Dockerfile instruction to declare that a container will listen on a specified network port for intercontainer communication.

Containerization

Question

A DevOps engineer has built a new container and must open port 8080 for intercontainer communication. Which command must be added in a Dockerfile to accomplish this goal?

Exhibit

300-910 question #22 exhibit

Options

  • AEXPOSE 8080
  • BFIREWALL ADD-PORT 8080
  • CPORT 8080
  • DOPEN PORT 8080

How the community answered

(22 responses)
  • A
    86% (19)
  • B
    9% (2)
  • D
    5% (1)

Why each option

The question asks for the correct Dockerfile instruction to declare that a container will listen on a specified network port for intercontainer communication.

AEXPOSE 8080Correct

The EXPOSE instruction in a Dockerfile informs Docker that the container listens on the specified network ports at runtime. While it does not actually publish the port, it serves as documentation and allows port mapping with 'docker run -p' or service definitions for intercontainer communication.

BFIREWALL ADD-PORT 8080

FIREWALL ADD-PORT 8080 is not a valid Dockerfile instruction.

CPORT 8080

PORT 8080 is not a valid Dockerfile instruction; EXPOSE is the correct keyword for this purpose.

DOPEN PORT 8080

OPEN PORT 8080 is not a valid Dockerfile instruction.

Concept tested: Dockerfile EXPOSE instruction

Source: https://docs.docker.com/reference/dockerfile/#expose

Topics

#Dockerfile#Containerization#Port exposure#Docker EXPOSE

Community Discussion

No community discussion yet for this question.

Full 300-910 Practice