ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 23 - XK0-005 discussion

Report
Export

A Linux administrator was asked to run a container with the httpd server inside. This container should be exposed at port 443 of a Linux host machine while it internally listens on port 8443. Which of the following commands will accomplish this task?

A.
podman run -d -p 443:8443 httpd
Answers
A.
podman run -d -p 443:8443 httpd
B.
podman run -d -p 8443:443 httpd
Answers
B.
podman run -d -p 8443:443 httpd
C.
podman run -d -e 443:8443 httpd
Answers
C.
podman run -d -e 443:8443 httpd
D.
podman exec -p 8443:443 httpd
Answers
D.
podman exec -p 8443:443 httpd
Suggested answer: A

Explanation:

The command that will accomplish the task of running a container with the httpd server inside and exposing it at port 443 of the Linux host machine while it internally listens on port 8443 is podman run -d -p 443:8443 httpd. This command uses the podman tool, which is a daemonless container engine that can run and manage containers on Linux systems. The -d option runs the container in detached mode, meaning that it runs in the background without blocking the terminal. The -p option maps a port on the host machine to a port inside the container, using the format host_port:container_port. In this case, port 443 on the host machine is mapped to port 8443 inside the container, allowing external access to the httpd server. The httpd argument specifies the name of the image to run as a container, which in this case is an image that contains the Apache HTTP Server software. The other options are not correct commands for accomplishing the task. Podman run -d -p 8443:443 httpd maps port 8443 on the host machine to port 443 inside the container, which does not match the requirement. Podman run -d -e 443:8443 httpd uses the -e option instead of the -p option, which sets an environment variable inside the container instead of mapping a port. Podman exec -p 8443:443 httpd uses the podman exec command instead of the podman run command, which executes a command inside an existing container instead of creating a new one. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Automating Tasks

asked 02/10/2024
Filippo Bertuzzi
26 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first