312-97 practice question 27 of 35

(Brady Coleman is a senior DevSecOps engineer at CloudVac Security Private Ltd. He has created a new container named “eccbrad” from the centos:7 image using the command docker run -i -t --name geeklab centos:7 /bin/bash. Now, Brady wants to install the httpd package inside the eccbrad container. Which of the following commands should Brady use to install the httpd package inside the container?)

Full set: 100 questions
Answer options
A: sudo install-httpd.
B: sudo install httpd.
C: yum install-httpd.
D: yum install httpd. Correct answer
Correct Answer:
D. yum install httpd.
Explanation

The scenario involves a Docker container created from the centos:7 image. CentOS 7 uses the Yellowdog Updater, Modified (YUM) as its default package manager. To install a software package like the Apache HTTP Server (httpd) inside this container, the correct command is yum install httpd. Since Docker containers often run the initial process as the root user by default, sudo is typically not required. The command yum install instructs the YUM package manager to download and install the specified package and its dependencies.

Why Incorrect

A. install-httpd is not a standard command, and sudo is likely unnecessary as the default user in a container is root.
B. install is not the correct command for the YUM package manager; yum is the command-line utility to be used.
C. The syntax yum install-httpd is incorrect. A space is required between the install action and the package name httpd.

References

- Red Hat. (2023). Chapter 9. Installing, removing, and upgrading packages. RHEL 7 System Administrator's Guide. Retrieved from https://access.redhat.com/documentation/en-us/redhatenterpriselinux/7/html/systemadministratorsguide/ch-yum. Section 9.2, "Installing Packages," specifies the command syntax as yum install packagename.

- Docker Inc. (n.d.). docker run reference. Docker Docs. Retrieved from https://docs.docker.com/engine/reference/run/. The documentation explains how containers are created from images. The behavior inside the container is determined by the base image's operating system, which is CentOS 7.

Scroll to Top