nerdexam
CompTIA

XK0-005 · Question #728

A Linux administrator needs to expose port 9000 for a container to listen during runtime. The Linux administrator creates a Dockerfile with the following entries. # Test-Container FROM node:9-alpine…

The correct answer is A. docker build -t Test-Container F. docker run -p 80:9000 Test-Container. First, the administrator should build the container image using the command docker build -t Test- Container, which creates a Docker image with the specified configuration. To run the container and expose port 9000, the correct command is docker run -p 80:9000 Test-Container…

Scripting, Containers, and Automation

Question

A Linux administrator needs to expose port 9000 for a container to listen during runtime. The Linux administrator creates a Dockerfile with the following entries. # Test-Container FROM node:9-alpine WORDDIR /usr/src/app COPY package*.json ./ RUN npm install copy . . EXPOSE 9000 CMD ['npm", "start"] Which of the following commands should the administrator use to accomplish this task? (Choose two).

Options

  • Adocker build -t Test-Container
  • Bdocker tag Test-Container
  • Cdocker inspect Test-Container
  • Ddocker run -p 5000:80 Test-Container
  • Edocker push Test-Container
  • Fdocker run -p 80:9000 Test-Container

How the community answered

(36 responses)
  • A
    75% (27)
  • B
    3% (1)
  • C
    3% (1)
  • D
    8% (3)
  • E
    11% (4)

Explanation

First, the administrator should build the container image using the command docker build -t Test- Container, which creates a Docker image with the specified configuration. To run the container and expose port 9000, the correct command is docker run -p 80:9000 Test-Container, which maps the container's port 9000 to port 80 on the host machine, making the service accessible externally on port 80.

Topics

#Docker#Containerization#Dockerfile#Port Mapping

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice