XK0-005 · Question #830
A Linux administrator needs to deploy an Apache web server in a container. In addition, the container needs to run in the background, and the web server needs to be exposed on port 8080 of the host…
The correct answer is B. sudo docker run -d -t -p 8080:80 --name myweb httpd. To deploy an Apache web server (httpd) in a Docker container, ensuring it runs in the background and exposes port 8080 on the host machine, the correct command should include: docker run - Creates and starts a new container. - Runs the container in detached mode (background)…
Question
A Linux administrator needs to deploy an Apache web server in a container. In addition, the container needs to run in the background, and the web server needs to be exposed on port 8080 of the host machine. Which of the following commands will satisfy these requirements?
Options
- Asudo docker run -b -t -p 8080:80 --name mywebserver httpd
- Bsudo docker run -d -t -p 8080:80 --name myweb httpd
- Csudo docker run -d -t -p 80:8080 --name myweb httpd
- Dsudo docker run -b -t -p 80:8080 --name mywebserver httpd
How the community answered
(40 responses)- A5% (2)
- B80% (32)
- C10% (4)
- D5% (2)
Explanation
To deploy an Apache web server (httpd) in a Docker container, ensuring it runs in the background and exposes port 8080 on the host machine, the correct command should include: docker run - Creates and starts a new container. - Runs the container in detached mode (background). -t - Allocates a pseudo-TTY, useful for interactive processes (though not strictly required here). -p 8080:80 - Maps port 8080 on the host to port 80 inside the container, where the Apache web server listens. --name myweb - Names the container myweb for easy reference. httpd - Uses the official Apache HTTP Server Docker image.
Topics
Community Discussion
No community discussion yet for this question.