CKAD Application Design and Build Practice Question
A developer creates a Dockerfile with the following content: FROM alpine:3.18 COPY app.sh /app.sh RUN chmod +x /app.sh CMD ["/app.sh"] They want to override the command to run '/app.sh --debug' when deploying the container in Kubernetes. Which of the following pod spec fields should they use?
⚠ Common exam trap
The CKAD exam often tests the confusion between `command` (overrides ENTRYPOINT) and `args` (overrides CMD), leading candidates to incorrectly choose `command` when they only need to append arguments to the existing command.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
spec.containers[].args
In Kubernetes, the `args` field overrides the CMD instruction from the Docker image. The Dockerfile's `CMD ["/app.sh"]` is replaced by `args: ["--debug"]`, which is appended to the ENTRYPOINT (defaulting to `/bin/sh -c` if not set, but here the ENTRYPOINT is `/app.sh` from the image's implicit ENTRYPOINT? Actually, the image has no explicit ENTRYPOINT, so the default is `/app.sh` from CMD? Wait — the Dockerfile has no ENTRYPOINT, so the container's entrypoint is the default `/bin/sh -c`? No, in Kubernetes, if no `command` is set, the image's ENTRYPOINT is used; if no ENTRYPOINT, then the image's CMD is used as the command. Here, the image has CMD `["/app.sh"]` and no ENTRYPOINT, so the container's command is `/app.sh`. Setting `args: ["--debug"]` will append `--debug` to that command, resulting in `/app.sh --debug`.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
spec.containers[].entrypoint
Why it's wrong here
The field `spec.containers[].entrypoint` does not exist in the Kubernetes Pod API; the correct field to override the Docker image's ENTRYPOINT is `spec.containers[].command`. Since this Dockerfile uses a CMD instruction to supply default arguments, specifying `entrypoint` is misplaced and unrecognized by the API server. You must use `args` to modify the CMD layer, not `entrypoint`.
- ✗
spec.containers[].command
Why it's wrong here
Setting `spec.containers[].command` would replace the container's ENTRYPOINT, but this Docker image's runtime behavior is defined by its CMD instruction, which provides default arguments to the existing ENTRYPOINT. Kubernetes maps `command` to Docker's ENTRYPOINT and `args` to Docker's CMD; therefore, to append `--debug` to the existing `/app.sh` invocation, you must target CMD using `args`. Using `command` would change the executable entirely and ignore the `--debug` argument, producing an unintended result.
- ✓
spec.containers[].args
Why this is correct
The `spec.containers[].args` field is correct because it directly overrides the Dockerfile's CMD instruction—the default argument list passed to the image's ENTRYPOINT. In this image, the ENTRYPOINT is `/app.sh`, and setting `args` to `['--debug']` replaces the default CMD arguments with `--debug`, resulting in the container process `/app.sh --debug`. This preserves the original entrypoint while changing its arguments, which is exactly what the developer intends.
- ✗
spec.command
Why it's wrong here
There is no `spec.command` field in the Pod specification; the container's command and arguments must be declared under `spec.containers[].command` and `spec.containers[].args`, respectively. A top-level `spec.command` is invalid schema and will be rejected by the Kubernetes API server. The correct way to override the image's CMD is `spec.containers[].args`, not a non-existent top-level field.
Go deeper
Related to this question
About these practice questions
One of 160 original CKAD practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.