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

Prepare for the KCNA Certification Test. Study with flashcards, multiple-choice questions, and detailed explanations to enhance your understanding of Kubernetes Cloud Native concepts. Ace your 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