2

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.

1

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.

| improve this answer | |
  • 1
    Thank you. I'll make a custom containerfile/image. – RootHouston May 29 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.