Command and Args
Docker container contains ENTRYPOINT
and CMD
which start when container starts. These can be modified in kubernetes in pod definition file.
command
is used to overwrite ENTRYPOINT
and args
for CMD
.
For example, let’s say we have container with sleep
as entrypoint
and 10
as cmd
. Below pod definition file shows how we can change it.
apiVersion: v1
kind: Pod
metadata:
name: sleep
spec:
containers:
- name: sleep
image: ubuntu
command: ["echo"]
args: ["Hello world"]
Now echo Hello world
will be run when the container starts.