<p>You can't add run-time dependencies on an already build image using a yaml manifest. 
You might attach/exec to an already running pod and install them, but it makes no sence, since you need to make sure that when the pod is re-created you do it again. The much better and right way is simply to describe it in your Dockerfile. </p>

<p>Kubernetes is not created for such kind of hacky moves. It simpy maintains state that you describe.  Essentially you need to add an instruction that adds git in your Jenkins dockerfile, build your new image and refer to it inside the manifest.</p>

<p>Commands and args are used if you want override the image's default entrypoint and its arguments.</p>

CC BY-SA 4.0
2020-05-29T05:54:45.103Z
Thank you. I'll make a custom containerfile/image.
Brian Reading
CC BY-SA 4.0
2020-05-28T19:46:22.380Z
2020-05-28T19:46:22.380Z
Recoba20
<p>In a container, there are RUN statements that you can add to a containerfile (such as a dockerfile) to add further dependencies using the package manager like APT or DNF within a container.</p>

<p>What is the proper equivalent to performing this in Kubernetes with a YAML manifest? For example, I'd like to install git in my Jenkins container so as to be able to use the git plugin in that application.</p>

<p>I tried to do this with "command" and "args" in the yaml, but it looks like it isn't executing as superuser? I get permission errors, and cannot install any packages that way.</p>

<kubernetes><jenkins-plugins>
How do I install local application dependencies in a Kubernetes manifest?
Brian Reading
# How do I install local application dependencies in a Kubernetes manifest?

(Asked by: username_0 on 2020-05-28)

In a container, there are RUN statements that you can add to a containerfile (such as a dockerfile) to add further dependencies using the package manager like APT or DNF within a container.

What is the proper equivalent to performing this in Kubernetes with a YAML manifest? For example, I'd like to install git in my Jenkins container so as to be able to use the git plugin in that application.

I tried to do this with "command" and "args" in the yaml, but it looks like it isn't executing as superuser? I get permission errors, and cannot install any packages that way.

**Tags:** kubernetes, jenkins-plugins


---

## 1 answers

### Answer by username_1 on 2020-05-28. Score: 2 | Accepted answer

You can't add run-time dependencies on an already build image using a yaml manifest.
You might attach/exec to an already running pod and install them, but it makes no sence, since you need to make sure that when the pod is re-created you do it again. The much better and right way is simply to describe it in your Dockerfile.

Kubernetes is not created for such kind of hacky moves. It simpy maintains state that you describe. Essentially you need to add an instruction that adds git in your Jenkins dockerfile, build your new image and refer to it inside the manifest.

Commands and args are used if you want override the image's default entrypoint and its arguments.

> **Comments:**
> **username_0**: Thank you. I'll make a custom containerfile/image.  

---

