<p>I want to create a container with the command line arguments <strong>--lines 56 -F</strong> .</p>
<ol>
<li><p>option: For this purpose I ran the command =&gt;  <strong><code>k run app --image=lfccncf/arg-output --dry-run=client -o yaml &gt; pod9.yaml</code></strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  labels:
    run: app
  name: app
spec:
  containers:
  - image: lfccncf/arg-output
    name: app
    args: [&quot;--lines&quot;,&quot;56&quot;,&quot;F&quot;]
</code></pre>
</li>
<li><p>option: Here is the second option how to accomplish the task.
<strong><code>kubectl run app1 --image=lfccncf/arg-output --dry-run=client --command [&quot;--lines 56 -F&quot;] -o yaml &gt; pod9.yaml</code></strong></p>
</li>
</ol>
<p>I have this restriction &quot;When creating your pod you do not need to specify a container command, only args&quot;. Which option is correct with the mentioned restriction?</p>

<p>Number 1 since you are saying that you don't need to specify the command and that assumes it's already pre-baked into the container image. <code>--lines 56 -F</code> are arguments and not 'the command'</p>
<p>Quoted from the <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#define-a-command-and-arguments-when-you-create-a-podhttps://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#define-a-command-and-arguments-when-you-create-a-pod" rel="nofollow noreferrer">docs</a>:</p>
<blockquote>
<p>The command and arguments that you define in the configuration file override the default command and arguments provided by the container image. If you define args, but do not define a command, the default command is used with your new arguments.</p>
</blockquote>
<p>A similar working approach would be:</p>
<pre class="lang-sh prettyprint-override"><code>$ kubectl run app1 --image=lfccncf/arg-output --dry-run=client -o yaml -- --lines 56 -F &gt; pod9.yaml
</code></pre>
