Which instruction defines the default command that runs when a container starts if no command is provided?

Study for the Kubernetes Cloud Native Associate (KCNA) Certification 1 Test. Master the core concepts of Kubernetes with multiple-choice questions and detailed explanations. Prepare and boost your confidence for the KCNA certification exam!

Multiple Choice

Which instruction defines the default command that runs when a container starts if no command is provided?

Explanation:
CMD defines the default command to run when the container starts if no command is provided. It sets what should execute by default, and you can override it at runtime by supplying a command, or provide default arguments to an ENTRYPOINT if one is defined. RUN is used during image build to install software, LABEL adds metadata to the image, and ENTRYPOINT fixes the executable to run (with CMD supplying its default arguments). Therefore, the default command instruction is CMD.

CMD defines the default command to run when the container starts if no command is provided. It sets what should execute by default, and you can override it at runtime by supplying a command, or provide default arguments to an ENTRYPOINT if one is defined. RUN is used during image build to install software, LABEL adds metadata to the image, and ENTRYPOINT fixes the executable to run (with CMD supplying its default arguments). Therefore, the default command instruction is CMD.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy