nerdexam
CompTIACompTIA

XK0-005 · Question #728

XK0-005 Question #728: Real Exam Question with Answer & Explanation

The correct answer is A: docker build -t 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, whic

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

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 PracticeBrowse All XK0-005 Questions