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.)
To download and run an Apache web server container in Docker with a port binding of 8080 in the container to port 80 on the host, you can use the following two commands:
1. docker pull httpd:latest - This command will download the latest version of the Apache web server Docker image from the Docker Hub.
2. docker run -p 80:8080 -d httpd - This command will start a new container based on the httpd image, with a port binding of 8080 in the container to port 80 on the host. The -d flag runs the container in detached mode, meaning it will run in the background and not block the terminal.
The command docker run -p host_port:container_port image_name is used to map a port on the host machine to a port inside a Docker container.
docker run: This initiates the creation and execution of a new container.
-p host_port:container_port: This is the port mapping flag.
host_port: The port on the host machine that will be exposed.
container_port: The port inside the container that the host port will be mapped to.
image_name: The name of the Docker image to use for creating the container.
For example, docker run -p 8080:80 nginx maps port 8080 on the host to port 80 inside the container running the nginx image. This means that requests to localhost:8080 on the host machine will be forwarded to the nginx server running on port 80 inside the container.
Key Points:
Host Port: This is the port on your local machine that you use to access the application running in the container.
Container Port: This is the port that the application inside the container is listening on.
To download and execute an Apache web server container in Docker with a port binding where port 8080 in the container is mapped to port 80 on the host, you need to use the docker pull command to pull the Apache image and the docker run command to start the container with the appropriate port mapping. Here are the two commands to achieve this:
Download the Apache image:
A. docker pull httpd
This command pulls the Apache HTTP Server image (httpd) from the Docker Hub.
Execute the Apache container with port mapping:
B. docker run -p 8080:80 httpd
This command runs the Apache container with port 8080 on the host mapped to port 80 in the container. The -p option specifies the port mapping.
So, options B and D are the correct commands for downloading and executing an Apache web server container with the specified port binding.
<port you are exposing>:<internal port> that's the way !!
upvoted 3 times
...
This section is not available anymore. Please use the main Exam Page.200-901 Exam Questions
Log in to ExamTopics
Sign in:
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.
chris_edwards
Highly Voted 1 year, 12 months agonospampls
Highly Voted 1 year, 11 months agonospampls
1 year, 11 months agoFinal5150
Most Recent 2 weeks, 4 days agokymoni
8 months, 3 weeks agolouisvuitton12
11 months, 1 week agoosamodas
1 year, 3 months agoymmit78
1 year, 3 months agocerifyme85
1 year, 11 months agooutrageous7
2 years ago