nerdexam
Cisco

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.

Containerization

Question

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?

Exhibit

300-910 question #24 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)
  • A
    3% (1)
  • B
    90% (36)
  • C
    5% (2)
  • D
    3% (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.

AENTRYPOINT <usr/sbin/apache2ctl>

ENTRYPOINT <usr/sbin/apache2ctl> uses an incorrect syntax for the ENTRYPOINT instruction; the exec form requires a JSON array.

BENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]Correct

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.

CENTRYPOINT ["BACKGROUND", "-D", "/usr/sbin/apache2ctl"]

ENTRYPOINT ["BACKGROUND", "-D", "/usr/sbin/apache2ctl"] incorrectly places 'BACKGROUND' as the executable and the web server command as an argument.

DENTRYPOINT {usr/sbin/apache2ctl}

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

#Dockerfile#ENTRYPOINT#Container Lifecycle#Web Server Deployment

Community Discussion

No community discussion yet for this question.

Full 300-910 Practice