<p>Dockerfile has a parameter for <em>ENTRYPOINT</em> and while writing Kubernetes deployment YAML file, there is a parameter in Container spec for <em>COMMAND</em>.</p>

<p>I am not able to figure out what's the difference and how each is used?</p>

<p>Kubernetes provides us with multiple options on how to use these commands:</p>

<p>When you override the default Entrypoint and Cmd in Kubernetes .yaml file, these rules apply:</p>

<ul>
<li>If you do not supply command or args for a Container, the defaults
defined in the Docker image are used.</li>
<li>If you supply only args for a Container, the default Entrypoint
defined in the Docker image is run with the args that you supplied.</li>
<li>If you supply a command for a Container, only the
supplied command is used. The default EntryPoint and the default Cmd
defined in the Docker image are ignored. Your command is
run with the args supplied (or no args if none supplied).</li>
</ul>

<p><em>Here is an example:</em></p>

<p>Dockerfile:</p>

<pre><code>FROM alpine:latest
COPY "executable_file" /
ENTRYPOINT [ "./executable_file" ]
</code></pre>

<p>Kubernetes yaml file:</p>

<pre><code> spec:
    containers:
      - name: container_name
        image: image_name
        args: ["arg1", "arg2", "arg3"]
</code></pre>

<p><a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/" rel="noreferrer">https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/</a></p>
