300-910 · Question #24
A DevOps engineer has built a container to host a web-server and it must run as an executable. Which command must be configured in a Dockerfile to accomplish this goal?
The correct answer is B. ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]. The question asks for the correct Dockerfile instruction to configure a container to run an executable, specifically a web server, using its command-line arguments to keep it in the foreground.
Question
Exhibit
Options
- AENTRYPOINT <usr/sbin/apache2ctl>
- BENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
- CENTRYPOINT ["BACKGROUND", "-D", "/usr/sbin/apache2ctl"]
- DENTRYPOINT {usr/sbin/apache2ctl}
How the community answered
(40 responses)- A3% (1)
- B90% (36)
- C5% (2)
- D3% (1)
Why each option
The question asks for the correct Dockerfile instruction to configure a container to run an executable, specifically a web server, using its command-line arguments to keep it in the foreground.
ENTRYPOINT <usr/sbin/apache2ctl> uses an incorrect syntax for the ENTRYPOINT instruction; the exec form requires a JSON array.
The ENTRYPOINT instruction configures a container to run as an executable. The exec form (using JSON array '["executable", "param1", "param2"]') is recommended as it properly handles signals and allows the 'CMD' arguments to be appended, enabling '/usr/sbin/apache2ctl -D FOREGROUND' to keep the server running in the foreground as process ID 1.
ENTRYPOINT ["BACKGROUND", "-D", "/usr/sbin/apache2ctl"] incorrectly places 'BACKGROUND' as the executable and the web server command as an argument.
ENTRYPOINT {{usr/sbin/apache2ctl}} uses an incorrect syntax with double curly braces instead of square brackets for the exec form of the instruction.
Concept tested: Dockerfile ENTRYPOINT instruction
Source: https://docs.docker.com/reference/dockerfile/#entrypoint
Topics
Community Discussion
No community discussion yet for this question.
