nerdexam
Cisco

200-901 · Question #320

Which two commands download and execute an Apache web server container in Docker with a port binding 8080 in the container to 80 on the host? (Choose two.)

The correct answer is C. docker run -p 80:8080 httpd D. docker pull httpd. Two commands are needed: (D) docker pull httpd downloads the official Apache HTTP Server image - the correct Docker Hub image name for Apache is httpd, not apache. Option A (docker pull apache) would fail as that is not a valid official image name. Option E (docker pull https) is

Application Deployment and Security

Question

Which two commands download and execute an Apache web server container in Docker with a port binding 8080 in the container to 80 on the host? (Choose two.)

Options

  • Adocker pull apache
  • Bdocker run -p 8080:80 httpd
  • Cdocker run -p 80:8080 httpd
  • Ddocker pull httpd
  • Edocker pull https

How the community answered

(25 responses)
  • A
    8% (2)
  • B
    4% (1)
  • C
    72% (18)
  • E
    16% (4)

Explanation

Two commands are needed: (D) docker pull httpd downloads the official Apache HTTP Server image - the correct Docker Hub image name for Apache is httpd, not apache. Option A (docker pull apache) would fail as that is not a valid official image name. Option E (docker pull https) is not a valid image. For running the container, the Docker port mapping syntax is -p host_port:container_port. Since the requirement is to map container port 8080 to host port 80, the correct flag is -p 80:8080, making (C) docker run -p 80:8080 httpd correct. Option B (-p 8080:80) reverses the mapping, binding host port 8080 to container port 80 - the opposite of the requirement.

Topics

#Docker#Containerization#Port Mapping#Apache

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice