exam questions

Exam XK0-005 All Questions

View all questions & answers for the XK0-005 exam

Exam XK0-005 topic 1 question 11 discussion

Actual exam question from CompTIA's XK0-005
Question #: 11
Topic #: 1
[All XK0-005 Questions]

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
  • B. podman run -d -p 8443:443 httpd
  • C. podman run –d -e 443:8443 httpd
  • D. podman exec -p 8443:443 httpd
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
JRS99
3 weeks, 4 days ago
Selected Answer: A
A. HOST:CONTAINER, 443 on the host and 8443 443:8443
upvoted 1 times
...
Mike313
4 months, 2 weeks ago
A. -p HOST:CONTAINER. (Maps Port) B Invalid as that is syntaxed as CONTAINER:HOST C Invalid as it uses the -e option (ENV VARIABLE) which is not used D Invalid for CONTAINER:HOST among other things.
upvoted 2 times
...
rfc_1918
11 months, 3 weeks ago
A. If you’re using docker compose the pattern is HOST:CONTAINER, i.e. 443 on the host and 8443 on the container would be 443:8443
upvoted 2 times
...
BryanSME
1 year ago
https://www.howtoforge.com/getting-started-with-podman-manage-images-container-and-volumes/ which is mentioned by Rob74613 also indicates host:container so A is correct Manage Containers At this stage, we learned about container image management. And the next step, we will learn how to create and manage containers with Podman. To create a new container, we can use 'podman run' command as below. podman run -d -p 8000:80 --name hakase-nginx docker.io/library/nginx The command will create a new container named 'hakase-nginx' based on the nginx image and will expose the port 8000 on the host machine. Details command options: -d - keep the container running in the background and just print the container ID as a result. -p 8000:80 - port mapping for container and the host system. Port 8000 on the host machine, and port 80 on the container. --name hakase-nginx - specify the container name with 'hakase-nginx'. Now display all running containers on the system.
upvoted 2 times
...
BryanSME
1 year ago
This is a useful article: https://docs.podman.io/en/latest/markdown/podman-run.1.html -p=[[ip:][hostPort]:]containerPort[/protocol] this would make "A" the correct answer
upvoted 1 times
...
nabalauski
1 year ago
Selected Answer: B
answer is B. The exposed port of an application can be mapped to a host port using the -p flag. For example, an httpd port 80 can be mapped to the host port 8080 using the following: $ podman run -p 8080:80 -d -i -t fedora/httpd
upvoted 1 times
...
[Removed]
1 year, 1 month ago
A should be correct
upvoted 1 times
...
DRVision
1 year, 1 month ago
Selected Answer: B
To create a new container, we can use 'podman run' command as below. podman run -d -p 8000:80 --name hakase-nginx docker.io/library/nginx The command will create a new container named 'hakase-nginx' based on the nginx image and will expose the port 8000 on the host machine. Details command options: -d - keep the container running in the background and just print the container ID as a result. -p 8000:80 - port mapping for container and the host system. Port 8000 on the host machine, and port 80 on the container. --name hakase-nginx - specify the container name with 'hakase-nginx'. Now display all running containers on the system.
upvoted 1 times
...
funax
1 year, 1 month ago
Selected Answer: A
<host_port>:<container_port>.
upvoted 2 times
...
clean_it_up_janny
1 year, 5 months ago
Selected Answer: B
concur with rob
upvoted 1 times
...
Rob74613
1 year, 6 months ago
Answer is B Source: https://www.howtoforge.com/getting-started-with-podman-manage-images-container-and-volumes/ look at section 3: Manage Contatiners
upvoted 3 times
...
mrtwister76
1 year, 7 months ago
Definitely A
upvoted 1 times
...
tutita
1 year, 7 months ago
Selected Answer: A
I checked the documentation and first is host port and then the container port, so option A should be the right one. since you are exposing the port 443 on the host to the port 8443 on the container
upvoted 2 times
...
Rob74613
1 year, 7 months ago
Selected Answer: B
B is correct -p 8443:443: This option specifies the port mapping. It maps port 8443 of the host machine to port 443 of the container.
upvoted 1 times
...
Aamm033
1 year, 9 months ago
Selected Answer: A
Ans is A.
upvoted 1 times
...
kloug
1 year, 10 months ago
bbbbbbbbb
upvoted 1 times
...
nixonbii
1 year, 10 months ago
According to the Podman documentation, the host machine port is the first parameter in the command when used with the -p option: -p=[[ip:][hostPort]:]containerPort[/protocol] Under this construction, answer A would be correct. I know that Podman can be seamlessly aliased to Docker in Ubuntu but I am not sure if Docker uses a different construction. I also think that the fact that Podman is a daemonless application influences how it interfaces with the O/S ports and protocols.
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago