A linux administrator is asked to run a container with an ht - CompTIA Linux + XK0-005

Question

A Linux administrator is asked to run a container with an HTTP server that listens internally on port 8443 and is exposed at port 443.
Which of the following commands will accomplish this task?

Answers
  1. correct
Explanation

Correct Answer: A. podman run -d -p 443:8443 httpd

Explanation (60–80 words):
The command podman run -d -p 443:8443 httpd runs a container in detached mode (-d) and publishes container port 8443 (where the HTTP server listens internally) to the host's port 443. This enables external clients to access the server through HTTPS on the standard port (443), while the application inside the container continues operating on port 8443. The -p option maps host ports to container ports in the format host:container.

Why other options are incorrect:

  • B. podman run -d -p 8443:443 httpd:
    This reverses the correct port mapping. It exposes the container’s port 443 to the host’s 8443, which is the opposite of the requirement. Clients would need to connect to port 8443 on the host instead of 443.

  • C. podman run -e 443:8443 httpd:
    The -e flag is used to set environment variables inside the container, not for port mapping. Using -e in this context will have no effect on the HTTP server’s port exposure and will not meet the stated requirement.

  • D. podman exec -p 8443:443 httpd:
    The podman exec command is used to run a command inside an already running container. It does not support port mappings and cannot be used to expose or bind ports between the host and container.

Related Courses

Discover a range of courses designed to provide you with the knowledge and skills needed to excel in your chosen field.

a prepsaret exam featured image
CompTIA Prep

220-1201 - CompTIA A+ Exam Core 1

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

220-1202 - CompTIA A+ Exam Core 2

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA SecurityX CAS-005

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Cloud Essentials+ CLO-002

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Network+ N10-009

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Security+ SY0-701

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Data + DA0-001

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Pentest+

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA CySA+ CSO-003

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA DataSys+ DS0-001

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Tech+ FC0-U71

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Cloud+ CV0-004

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Server+ SK0-005

Start Course Prep

Easy way to pass your test within a week with prepsaret

You don’t need one month to study and pass your test.
With Prepsaret, it takes you a few days to grasp all the concepts needed to pass your exams

View Courses Offered