Commands and Arguments

Containers are meant to run a specific process. Once the task is complete the container exits. CMD within Dockerfile defines the default command that runs inside the container once it starts.

command overrides the entrypoint used in Dockerfile. args override the cmd field in the Dockerfile.

spec:
    containers:
    - name: ubuntu-sleeper
      image: ubuntu-sleeper
      command: [ "sleep" ]
      args: [ "infinite" ]

The inclusion of command and args in a pod in deployment takes the form of the following screenshot

Image command and arguments