<p>You can include the arguments in the deployment yaml.  The <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/" rel="nofollow noreferrer">official docs</a> include examples and further customization.</p>

<pre><code>spec:
   containers:
     image: myimage
     name: myContainerName
     args: ["me", "yes", "https://my.url"]</code></pre>

CC BY-SA 4.0
2020-01-31T20:23:08.347Z
2020-01-31T20:23:08.347Z
Wesley Rolnick
<p><strong>Background</strong></p>

<p>I have a docker container that I run in the following fashion:  </p>

<p><code>docker run --rm my-custom-container:latest --username me --password yes --url "https://my.url"</code></p>

<p>The container does what what it needs to do with no issues.</p>

<p>I have pushed my container image to a private image repository, and I am able to create a Kubernetes deployment. Kubernetes is able to pull the container from the private image repository for the container with no problems.</p>

<p><strong>Problem</strong></p>

<p>However, when Kubernetes goes to start the container it returns with an error stating that it cannot run the container.</p>

<p>This is due to a lack of parameters being passed to the container to run.</p>

<p><strong>Question</strong></p>

<p>How do I pass parameters to my container during a Kubernetes deployment?</p>

CC BY-SA 4.0
2020-01-31T08:31:53.823Z
https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/
Yuri G.
<docker><kubernetes><containers><configuration><orchestration>
How to pass parameters to a container orchestrated by Kubernetes similar to running the container at the command line using the docker run command?
Dodzi Dzakuma
# How to pass parameters to a container orchestrated by Kubernetes similar to running the container at the command line using the docker run command?

(Asked by: username_0 on 2020-01-31)

**Background**

I have a docker container that I run in the following fashion:

`docker run --rm my-custom-container:latest --username me --password yes --url "https://my.url"`

The container does what what it needs to do with no issues.

I have pushed my container image to a private image repository, and I am able to create a Kubernetes deployment. Kubernetes is able to pull the container from the private image repository for the container with no problems.

**Problem**

However, when Kubernetes goes to start the container it returns with an error stating that it cannot run the container.

This is due to a lack of parameters being passed to the container to run.

**Question**

How do I pass parameters to my container during a Kubernetes deployment?

**Tags:** docker, kubernetes, containers, configuration, orchestration

> **Comments:**
> **username_1**: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/  

---

## 1 answers

### Answer by username_2 on 2020-01-31. Score: 2 | Accepted answer

You can include the arguments in the deployment yaml.  The official docs include examples and further customization.
spec:
   containers:
     image: myimage
     name: myContainerName
     args: ["me", "yes", "https://my.url"]


---

