OpenShift Set Image Example¶
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.
Before You Start¶
Make sure you are in the correct project and know whether the application is driven by a Deployment, DeploymentConfig, BuildConfig, ImageStream, or external registry image.
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
Troubleshooting¶
Confirm the target image exists, update the correct container name, watch the rollout, and verify the new pod is running the intended image.
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.
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.
Related Guides¶
- Openshift New App Explained
- Openshift Imagestream Explained
- Openshift Application Deployment Checklist
Summary¶
OpenShift Set Image Example should be verified with commands that match the OpenShift object being changed or investigated.