CloudsArk
oc Commands Openshift

oc Set Image Examples

Learn practical oc set image examples with oc commands, OpenShift manifests, verification steps, common mistakes, and production-focused guidance.

oc Set Image Examples

Introduction

oc set image changes the container image used by a workload. It is common during manual rollouts, emergency rollback tests, and promotion from a tested ImageStreamTag.

When You Need This Command

Use this command when you need to inspect, change, or verify OpenShift resources from the terminal without relying on the web console.

Syntax

oc <command> <resource> [name] -n <project>

Practical Examples

oc set image deployment/web web=image-registry.openshift-image-registry.svc:5000/app/web:v2 -n app
oc rollout status deployment/web -n app
oc describe deployment web -n app
oc get pods -n app -l app=web

Example output:

deployment.apps/web image updated
deployment "web" successfully rolled out

Verification

oc get deployment web -n app -o jsonpath="{.spec.template.spec.containers[0].image}"
oc rollout history deployment/web -n app

Common Mistakes

  • Updating the wrong container name in multi-container pods.
  • Using a tag that was not pushed to the registry.
  • Skipping rollout status after changing the image.

Production Notes

Run read-only commands first, check the active project, and prefer declarative manifests for repeatable changes.

Quick Checklist

  • Confirm the active project.
  • Inspect the exact object named in the error.
  • Read recent events.
  • Apply one focused fix.
  • Verify status after the change.

Summary

oc Set Image Examples is most useful when paired with verification. Check the project, run the command against the intended object, and confirm the resulting OpenShift state.