Citronen
Citronen

Reputation: 4500

Adding docker container to running OpenShift pod

I can add a container to a pod by editing the pod template, but I'm looking for something simpler. Is there any way to add a container to a deployed OpenShift pod without editing the pod template? CLI preferable.

Upvotes: 3

Views: 1784

Answers (2)

Clayton
Clayton

Reputation: 3326

There is no command today that makes it easy to add a container to the pod template for an RC or deployment. You can use oc new-app to quickly generate deployment configs that have multiple containers with

oc new-app php+apache+somethingelse

But this won't let you deeply customize those containers.

Agree this would be nice to have - as a mode to "run", perhaps.

Upvotes: 2

Tim Allclair
Tim Allclair

Reputation: 7827

You cannot add or remove containers in a running pod. If you are using replication controller, kubectl rolling-update is the easiest solution, but this will require editing the pod template. That said, are you sure you need to add your containers to the existing pod? Unless strictly necessary, it's better to just run the new containers in a separate pod, e.g. with kubectl run <name> --image=<image>

Note: This is the generic kubernetes answer, there may be a more elegant solution for OpenShift

Upvotes: 2

Related Questions